LearnBoost/socket.io-client — Issue #373: Socket improperly handles errors when connecting
Author: SlNPacifist
Created: 2012-01-20 08:58:29+00:00
State: open

At line https://github.com/LearnBoost/socket.io-client/blob/master/lib/socket.js#L221 xhr-based transport starts polling, but server responses with "not handshaken" error.
Socket doesn't handle disconnect as socket.connected flag is not set yet and transport is left open. While transport is open it sends "null" each time it receives data from server in order to keep connection to server. For example, xhr-polling does it in https://github.com/LearnBoost/socket.io-client/blob/master/lib/transports/xhr-polling.js#L71.
This patch closes transport if socket gets error with "reconnect" advice during connecting process.