Last post Sep 02, 2014 11:20 PM by Kevin Shen - MSFT
Sep 02, 2014 04:50 AM|Viratz|LINK
How does SignalR tries to reconnect in case of server disconnection (particularly when azure WebRole crashes/restarts/recycles). Let's say, I've 2 instances of WebRole and one of the instance crashes, then all the affected clients will try to connect to
the other WebRole at the same time? This can make the other WebRole crash too due to sudden heavy load, assuming 1000s of clients. Or, even if I've just one instance of webRole and it restarts...
How frequently do the clients try to reconnect to server in such cases? Can I somehow randomize/control the time between two reconnection retries?
Sep 02, 2014 11:20 PM|Kevin Shen - MSFT|LINK
When a server goes offline -- it reboots, fails, the app domain recycles, etc. -- the result might be similar to a lost connection, or the transport API and SignalR might know immediately that the server is gone, and SignalR might begin trying to reconnect
without raising the ConnectionSlow event.
If the client goes into reconnecting mode, and if the server recovers or restarts or a new server is brought online before the disconnect timeout period expires, the client will reconnect to the restored or new server. In that case, the SignalR connection
continues on the client and the Reconnected event is raised.
on the first server,OnDisconnected is never executed, and on the new server, OnReconnected is executed although OnConnected was never executed for that client on that server before.
You can refer to the link below about handling server disconnect via SignalR:
You can try the code below to reconnect the server continuously:
}, 5000); // Restart connection after 5 seconds.you can set the time based your requirement
You can refer to the link about continousreconnect: