LearnBoost/socket.io-client — pull request #438 by ycarmel (2012-05-24 14:13:29+00:00)
Title: Fix issues around fallback mechanism and xhr-polling heartbeat

Issue 1 (Fix reconnect issue when using the fallback mechanism of connect timeout) Flow:
Using multiple transports, and a certain transport fails to connect (first connect try).
After the 'connect timeout' the next transport will be choosen.
This transport is successfully connected and the connection drops after certain time.
The first transports will be used again and fallback mechanism stops working causing the connection to always fail.
Fix: Choose the right transport that is successful and then when connection disconnects continue using it to reconnect.

Issue 2 ( Fix disconnects when fallback to xhr-polling (heartbeat related)) Flow:
When a certain connect fail and fall backs to xhr-polling and heartbeat is enabled, the xhr-polling is established by disconnects after several seconds due to a heartbeat timeout.
Fix: Since the server is disabling heartbeat to xhr-polling and client disables the heatbeat timeout for it in this case. It may be better for the server to tell the client when heartbeat is disabled and then the client stops the timer.