socketio / socket.io-protocol

Socket.IO Protocol specification
https://socket.io
507 stars 62 forks source link

Further explain the protocol (pieces are missing) #12

Closed marcofranssen closed 8 years ago

marcofranssen commented 9 years ago

The protocol is not very clear on how it exactly works. As Example this issue. https://github.com/Automattic/socket.io/issues/1894

Nowhere is described that upgrading the connection needs a 5 to be sent over the websocket to complete it before other messages are sent.

connecting to a namespace requires a 40.

However that number is not explained over here.

4 means error 0 means connect

daid commented 9 years ago

Actually, I think this document is an insult to actual protocol descriptions. As it reads like some odd document which cannot decide if it's a protocol description or an API documentation.

Grant1219 commented 9 years ago

Yea I agree with daid... your best bet is probably installing the node.js server and the example programs, then using tcpdump or another sniffer to analyze the protocol. That's what I'm trying to do at the moment anyway.

thetrompf commented 9 years ago

The 4 comes from the engine.io-protocol, so when looking at the raw data send over the wire, it goes through two "protocols" the raw transportation layer (engine.io-protocol) and then the specific transport layer, in this case socket.io-protocol, so 40 means 4 (message from the engine.io-protocol) and 0 which means connect, and then the rest is the /nsp part.

So we tell the abstract transport layer (engine-io) that here comes a message, and the message type in socket.io-protocol is connect which means that you are connecting to a namespace.

rauchg commented 8 years ago

I'm closing this in favor of #14, let's continue the discussion there.