For debugging, you might want to try out Theseus.
Here is a short overview of the socket.io SPEC:
Socket.IO aims to bring a WebSocket-like API to many browsers and
devices, with some specific features to help with the creation of
real-world realtime applications and games.
- Multiple transport support (old user agents, mobile browsers, etc).
- Multiple sockets under the same connection (namespaces).
- Disconnection detection through heartbeats.
- Optional acknoledgments.
- Reconnection support with buffering (ideal for mobile devices or bad networks)
- Lightweight protocol that sits on top of HTTP.
Anatomy of a Socket.IO socket
A Socket.IO client first decides on a transport to utilize to connect.
The state of the Socket.IO socket can be disconnected
,
disconnecting
, connected
and connecting
.
The transport connection can be closed
, closing
, open
, and
opening
.
A simple HTTP handshake takes place at the beginning of a Socket.IO
connection. The handshake, if successful, results in the client
receiving:
- A session id that will be given for the transport to open connections.
- A number of seconds within which a heartbeat is expected (
heartbeat timeout
)
- A number of seconds after the transport connection is closed when the socket is considered disconnected if the transport connection is
not reopened (
close timeout
).
At this point the socket is considered connected, and the transport is
signaled to open the connection.
If the transport connection is closed, both ends are to buffer
messages and then frame them appropriately for them to be sent as a
batch when the connection resumes.
If the connection is not resumed within the negotiated timeout the
socket is considered disconnected. At this point the client might
decide to reconnect the socket, which implies a new handshake.
If you need more of the details, you can read the rest of the specification here