Detect Client-side reconnection with SignalR
Signalr is really good on keeping alive the connection between server and the client and make sure that the client automatically reconnect if there are connection issue. To verify this you can write a simple test with a simple hub that each second broadcasts to all clients current server timestamp with a simple timer.
Now you can simply reference the hub on a page, register for the setTime method and watch the page dynamically update each second.
This is a simple KnockoutJs view model, you can now bind a simple span to the property serverTime and watch everything works.
Figure 1: Web page automatically updated from the server
The interesting part is that you can now kill the w3wp.exe process from the task manager (if you are using IIS) or whatever hosting server you are using, and you can verify that almost immediately w3wp.exe process is bring to life again and the timer continues to count. This happens because when the client detect that the server is dead, it tries automatically to reconnect, then IIS creates another worker process and everything starts working again.
This simple code is used to detect when the state of the connection changed, I store this information inside a KnockoutJS View Model variable, to be informed of the actual status, then I simply detect if the new state is reconnecting and I simply call initialization function on the server to re-register information for this client connection.