Closed coolaj86 closed 1 year ago
Hi!
EIO=3
means:
The payload is encoded twice, once at the Socket.IO level, and then at the Engine.IO level. So, in your example:
22:423["subscribe","inv"]23:424["subscribe","sync"]23:424["subscribe","sync"] [...]
At the Engine.IO level:
part | explanation |
---|---|
22 |
the length of the 423["subscribe","inv"] string (to split the payload into distinct packets) |
: |
Engine.IO separator |
4 |
Engine.IO "message" packet type |
23["subscribe","inv"] |
the data in the Engine.IO packet |
Then at the Socket.IO level:
part | explanation |
---|---|
2 |
Socket.IO "event" packet type |
3 |
the acknowledgement ID |
["subscribe","inv"] |
the JSON.stringified version of the arguments, in that case socket.emit("subscribe", "inv") |
The acknowledgement ID is a number that is incremented for each packet needing an acknowledgement:
socket.emit("subscribe", "inv", (response) => {
// ...
});
Though the fact that they are out of order in your example is a bit surprising.
I think this can be closed now, please reopen if needed.
Yes.
I didn't see the notification about the answer at the time, but thank you so much @darrachequesne for such a great explanation.
I'm pretty sure I'll need to reference this again in the future, so I'm glad to have it.
I'm trying to communicate with an
EIO=3
socket.io server and I'm noticing that there's this 42x number showing up in front of the subscriptions after the length:For the life of me, I cannot figure out what this is supposed to mean, and I can't seem to find any documentation referencing this protocol version, nor can I find this pattern in the current versions of reference implementations that I've looked at.
It seems like the 42x number rotates, but not in any order I can understand.
I'd love some help deciphering what's going on here.