title: SignalR .NET Client timing out
body: <p>Here is what our setup looks like:</p>
  
  <ul>
  <li>SignalR Server (an ASP.NET MVC application) on windows Server 2012.</li>
  <li>Sencha HTML5 apps (SignalR clients) on the same server (Windows Server 2012).</li>
  <li>.NET Windows Service on a Windows Server 2008 R2 server. This also acts as a SignalR client.</li>
  </ul>
  
  <p>We are using the SignalR development build from a couple of weeks ago (1.1.0). Occasionally, we find that the SignalR server loses the connection to the .NET client. Using the latest build allowed us to add client-side logging.</p>
  
  <p>We have a good example of this happening last Thursday (28 Mar 2013 at 6.33 PM).</p>
  
  <p>Client-side log (for the sake of brevity, I have removed any logs that are not important). Note that the Hub class is called "Transmitter".</p>
  
  <pre><code>ChangeState(New connection, Disconnected, Connecting)
  WS: wss://www.myURL.com/SignalRServer/signalr/connect?transport=webSockets&amp;connectionToken=fsfY8BWv5eiSNuQtHW6wfY6XWDInkrVEn5fyHogSIyapob1BxoZLz0aMO_IuARmd9suam3my3yU0sQOEYMah-ZVj_4idQHXKQmhUKyRFlNgObCWlblCDfXflOq4Fxt8P0&amp;connectionData=[{"Name":"Transmitter"}]
  Auto: Failed to connect to using transport webSockets. System.PlatformNotSupportedException: The WebSocket protocol is not supported on this platform.
     at System.Net.WebSockets.ClientWebSocket..ctor()
     at Microsoft.AspNet.SignalR.Client.Transports.WebSocketTransport.&lt;PerformConnect&gt;d__0.MoveNext()
  SSE: GET https://www.myURL.com/SignalRServer/signalr/connect?transport=serverSentEvents&amp;connectionToken=fsfY8BWv5eiSNuQtHW6wfY6XWDInkrVEn5fyHogSIyapob1BxoZLz0aMO_IuARmd9suam3my3yU0sQOEYMah-ZVj_4idQHXKQmhUKyRFlNgObCWlblCDfXflOq4Fxt8P0&amp;connectionData=[{"Name":"Transmitter"}]
  ChangeState(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Connecting, Connected)
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: initialized)
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {"C":"B,25|1,0|2,0|3,0","M":[{"H":"Transmitter","M":"joined","A":["0e3cd780-9efc-4824-b9a2-bae81b9be17f","27/03/2013 8:16:46 PM"]}]})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {"C":"B,25|1,1|2,0|3,0","M":[{"H":"Transmitter","M":"isLoggedIn","A":[true]}]})
  OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, {"I":"0"})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  ............
  ............
  ............
  ............
  ............
  ............
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  Connection Timed-out : Transport Lost Connection 28/03/2013 8:33:14 AM
  ChangeState(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Connected, Reconnecting)
  SSE: GET https://www.myURL.com/SignalRServer/signalr/?transport=serverSentEvents&amp;connectionToken=fsfY8BWv5eiSNuQtHW6wfY6XWDInkrVEn5fyHogSIyapob1BxoZLz0aMO_IuARmd9suam3my3yU0sQOEYMah-ZVj_4idQHXKQmhUKyRFlNgObCWlblCDfXflOq4Fxt8P0&amp;messageId=B%2C6&amp;connectionData=[{"Name":"Transmitter"}]
  ChangeState(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Reconnecting, Connected)
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: initialized)
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {"C":"B,7","M":[{"H":"Transmitter","M":"rejoined","A":["0e3cd780-9efc-4824-b9a2-bae81b9be17f","28/03/2013 6:33:12 PM"]}]})
  OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, {"I":"12"})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  ............
  ............
  </code></pre>
  
  <p>Before the connection times out, everything works as expected - the SignalR server can call .NET client's methods and vice versa.
  After the connection times out, the .NET client can call server Hub methods, but the server cannot call the .NET client methods. </p>
  
  <p>Other things to note:</p>
  
  <ul>
  <li>Note that the connection times out reporting "28/03/2013 8:33:14 AM" as the time. This is different to the times logged in subsequent entries and the time was actually 6:33:14 PM (Australian EST).</li>
  <li>As can be seen above ServerSentEvents is being used as the SignalR .NET client is on a Windows 2008 server.</li>
  <li>There is no pattern to the timeout. Sometimes it does not happen for days, other times it happens within a few hours.</li>
  <li>The timeout is not related to the the machines (both, where the SignalR server or the the SignalR client reside) being rebooted, IIS resets, etc.</li>
  </ul>
  
  <p>Also, this is quite different to momentary connection losses and re-connections, which seem to work as required. An example of a momentary loss in connection is shown below:</p>
  
  <pre><code>SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  ChangeState(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Connected, Reconnecting)
  SSE: GET https://www.myURL.com/SignalRServer/signalr/?transport=serverSentEvents&amp;connectionToken=fsfY8BWv5eiSNuQtHW6wfY6XWDInkrVEn5fyHogSIyapob1BxoZLz0aMO_IuARmd9suam3my3yU0sQOEYMah-ZVj_4idQHXKQmhUKyRFlNgObCWlblCDfXflOq4Fxt8P0&amp;messageId=B%2C1D%7CF%2CE%7CG%2C0%7CH%2C0&amp;connectionData=[{"Name":"Transmitter"}]
  ChangeState(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Reconnecting, Connected)
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {"C":"B,2","M":[{"H":"Transmitter","M":"rejoined","A":["00fabf13-eb07-4704-8d43-4d8865a519f0","28/03/2013 4:08:26 PM"]}]})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: initialized)
  OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, {"I":"11"})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  SSE: OnMessage(0e3cd780-9efc-4824-b9a2-bae81b9be17f, Data: {})
  </code></pre>
  
  <p>What I don't understand is why the momentary connection losses and re-connections seem to work, but the reconnections after a connection time-out do not work.</p>
  
  <p>Is there anything that we can do to address this?</p>
  
  <p>Thanks in advance.</p>