Version 4.5.0
April 23, 2022
Server
Bug Fixes
Features
Catch-all listeners for outgoing packets
This is similar to onAny()
, but for outgoing packets.
Syntax:
socket.onAnyOutgoing((event, ...args) => {
console.log(event);
});
Added in 531104d.
Broadcast and expect multiple acknowledgements
Syntax:
io.timeout(1000).emit("some-event", (err, responses) => {
// ...
});
Added in 8b20457.
maxHttpBufferSize
value negotiation
A "maxPayload" field is now included in the Engine.IO handshake, so that clients in HTTP long-polling can decide how many packets they have to send to stay under the maxHttpBufferSize
value.
This is a backward compatible change which should not mandate a new major revision of the protocol (we stay in v4), as we only add a field in the JSON-encoded handshake data:
0{"sid":"lv_VI97HAXpY6yYWAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000,"maxPayload":1000000}
Added in 088dcb4.
Dependencies
Client
Features
Additional details for the disconnect event
The "disconnect" event will now include additional details to help debugging if anything has gone wrong.
Example when a payload is over the maxHttpBufferSize value in HTTP long-polling mode:
socket.on("disconnect", (reason, details) => {
console.log(reason); // "transport error"
// in that case, details is an error object
console.log(details.message); "xhr post error"
console.log(details.description); // 413 (the HTTP status of the response)
// details.context refers to the XMLHttpRequest object
console.log(details.context.status); // 413
console.log(details.context.responseText); // ""
});
Added in b862924.
Catch-all listeners for outgoing packets
This is similar to onAny()
, but for outgoing packets.
Syntax:
socket.onAnyOutgoing((event, ...args) => {
console.log(event);
});
Added in 74e3e60.
Slice write buffer according to the maxPayload value
The server will now include a "maxPayload" field in the handshake details, allowing the clients to decide how many packets they have to send to stay under the maxHttpBufferSize
value.
Added in 46fdc2f.