1

I am currently using SignalR 1.0.0Alpha2. I have overriden the OnDisconnected method (previously I had implemented the same functionality by implementing Disconnect()). But the issue I am facing is that on a refresh of page or disconnection the OnDisconnected is being called immediately. My understanding is that it should be called after 20secs (assuming DisconnectTimeout default value is 20 secs.

For our application's requirement, we want that the OnDisconnected be called after about 30secs. I have tried follow the documentation and and set DisconnectTimeout to higher value but that does not help.

Back in 0.4.x version, I was able to implement DisconnectTimeout successfully and the delay was honored. But since 0.5.3 we are not seeing this behaviour.

I am not sure what are we doing wrong. All we need is that the OnDisconncted be not called immediately.

1 Answer 1

0

There's no way to delay OnDisconnected. If you want to delay running your logic, you can always do Task.Delay or Thread.Sleep (if you want to block).

2
  • Sure thanks. I am currently using Thread.Sleep and business logic to determine if the session has really ended or just reconnected. But am I correct if I say that the behavior has changed from 0.4.x versions where the DisconnectTimeout used to delay call to Disconnect()?
    – Gourav Das
    Dec 3, 2012 at 3:07
  • Oh yes it has changed. Disconnect gets called in 2 cases. It gets called immediately when the browser is closed or when connection.Stop is called client side. When the browser crashes or if the client doesn't goes away without a chance to send a packet to the client then it goes away eventually (DisconnectTimeout).
    – davidfowl
    Dec 3, 2012 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.