Once the transport's connection is established, all the communication between the client and server happens using messaging over the socket. The messages need to be encoded in the format specified by socket.io.
This format enables socket.io to determine the type of the message and the data sent in the message, and some metadata useful for operation. The message format is [type] : [id ('+')] : [endpoint] (: [data])
.
type
is a single digit integer, specifying what type of message it is.id
is the message ID, which is an incremental integer; it is used for ACKs. It is optional.The
+
sign, if present, tells socket.io not to handle the ACKs, as the application intends to handle it.endpoint
is the socket endpoint that the message is intended to be delivered to. This is optional and is used when multiplexing the socket for namespacing. If omitted, the message will be sent to the default socket.data
is the associated data to be delivered to the socket. In the case of messages...