This major release contains the necessary changes for the version 4 of the Engine.IO protocol. More information about the new version can be found there.
Encoding changes between v3 and v4:
encodePacket with string
{ type: "message", data: "hello" }
"4hello"
"4hello"
encodePacket with binary
{ type: 'message', data: <Buffer 01 02 03> }
<Buffer 04 01 02 03>
<Buffer 01 02 03>
encodePayload with strings
[ { type: 'message', data: 'hello' }, { type: 'message', data: '€€€' } ]
"6:4hello4:4€€€"
"4hello\x1e4€€€"
encodePayload with string and binary
[ { type: 'message', data: 'hello' }, { type: 'message', data: <Buffer 01 02 03> } ]
<Buffer 00 06 ff 34 68 65 6c 6c 6f 01 04 ff 04 01 02 03>
"4hello\x1ebAQID"
Please note that the parser is now dependency-free! This should help reduce the size of the browser bundle.
Protocol v3: { type: 'message', data: } => Protocol v4: { type: 'message', data: } =>
Reference: https://nodejs.org/docs/latest/api/buffer.html#buffer_class_method_buffer_allocunsafe_size