The value stored in the adapter will now be used, instead of
duplicating it in the Socket class.
Breaking change: Socket#rooms is now a Set instead of an object
Closes https://github.com/socketio/socket.io/issues/2890
This was needed in a previous version of the parser, which used msgpack
to encode the payload.
Blobs (and Files) will now be included in the array of binary
attachments without any additional transformation.
Breaking change: the encode method is now synchronous
See also 299849b002
The assertions were not checked, because the functions are asynchronous.
Besides, the Blob tests were throwing in the browser:
> Uncaught ReferenceError: can't access lexical declaration 'BlobBuilder' before initialization
It does not make sense to catch the errors thrown by JSON.stringify()
and convert them to an ERROR packet (which are meant for namespace
authentication errors), it should be caught higher in the stack.
Related: 92c530da47
An invalid packet was previously parsed as an ERROR packet, which was
then ignored because it didn't contain any 'nsp' (namespace) field.
This behavior was wrong because:
- it means the other side is sending invalid payloads, so the
connection must be closed right away
- ERROR packets are meant for namespace authentication failures
Parsing an invalid payload will now throw an error, which must be
caught by the caller.
Closes https://github.com/socketio/socket.io-parser/issues/86
The sids and the rooms objects are now Map<string, Set<string>>:
sids => Map<SocketId, Set<Room>>
rooms => Map<Room, Set<SocketId>>
Breaking changes: the clients() and clientRooms() methods will now
return a Set instead of an array.
Also, the rooms argument in the broadcast() method will now be a Set
too.
Besides, the callbacks were removed from all function signatures, as
every operation is synchronous. Regarding the Redis adapter, the
clients() method is the only operation which will now return a promise.
This change allows us to remove the Room class, which was used to have
an external length attribute (instead of computing Object.keys()
everytime).
The eiows package is the published version of [1], which is a fork of
uws (a performant WebSocket server written in C++ with bindings for
Node.js).
[1] https://github.com/mmdevries/uws
The enchilada module fails to bundle the Engine.IO client, so we'll
just import the published bundle.
The exception seems to come from debug:
> Spread must be the final element of an element list
By default, terser (the mangler used by webpack) will replace the '\x1e'
by an unreadable character in the optimized output.
One solution would be to use the 'ascii_only' option:
```
module.exports = {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
ascii_only: true
}
}
})
]
}
};
```
But it would require anyone who tries to bundle the engine.io client to
use this plugin, so we'll rather use String.fromCharCode().
Note: String.fromCharCode(30) === '\u001e' === '\x1e'
The WebSocket permessage-deflate extension, while useful is some cases,
adds some extra memory overhead for each WebSocket connection, and
results in huge memory usage in production deployments.
It will now be disabled by default.