The socket.io socket emulates a network socket over different transport mechanisms. Just as any other socket, it has various stages in its lifecycle, depending on the status of the connection. These are as follows:
connecting
connected
disconnecting
disconnected
The socket is established when the client sends a connection request to the server and a handshake is initiated.
Once the handshake is complete, a connection is opened using the transport negotiated during the handshake, and the state of the socket is set to connected.
To check the liveliness of the socket depending on the server configuration, the server may require heartbeat messages to be sent from the client to the server in regular intervals. In the absence of such a message, or the failure of the underlying transport, the socket will be disconnected.
In this case, the client will initiate a reconnect. If the connection is restored within the connection termination time or the timeout agreed at the time of the...