title: detecting connection lost in SignalR from client side
body: <p>I am connecting a simple application to a server that hosts my web-pplication. My web-application uses SignalR 2. Everything is going smooth and my little application can sync with the web-application and receives messages sent from it. But, when the web-page is updated or the server restarts and it loses its connections, the application cannot understand that the connection is lost from server. The following is my codes:</p>
  
  <pre><code>// initializing connection
  HubConnection connection;
  IHubProxy hub;
  
  connection = new HubConnection(serverAddress);
  hub = connection.CreateHubProxy("MyPanel");
  hub.On&lt;string&gt;("ReciveText", (msg) =&gt; recieveFromServer(msg));
  </code></pre>
  
  <p>A thread checks the connection every 1 minutes, but every time it checks, the state of the connection is “Connected” while the connection from server side is lost. Is there anything that I am missing here?</p>
  
  <pre><code>if (connection.State == ConnectionState.Disconnected)
  {
      // try to reconnect to server or do something
  }
  </code></pre>