SignalR/SignalR — pull request #1553 by brutaldev (2013-02-20 09:55:06+00:00)
Title: Fix problem with < .NET4.5 clients infinitely reconnecting because the SSE response is not cancelled when a timeout occurs.

When the timout exception occurs nothing prevents the SSE source from
starting allowing multiple conenctions to the server from the same .NET
client to infinitely reconnect.

The AutoTransport.ResolveTransport gets the timeout and proceeds with
Long Polling even though the server will eventually come back and
successfully start the SSE source. Multiple connections to the server
will cause the Long Polling to get kicked off trigger a reconnect which
endlessly cycles through the two connection types and the client
reconnects infinitely.

- This was described in https://github.com/SignalR/SignalR/issues/910.
- This generally happens on client using .NET4.0 and below where
WebSockets is not available.
- Two seconds also seems a bit short and increasing the value to 5
seconds makes this far less likely to occur.
- Checking a token ensures that SSE will not be enabled when a
TimeoutException has already been raised faulting the task created by
AutoTransport.
- This issue can be reproduced by creating a delay (Fiddler) in the
response to connect?transport=serverSentEvents.