fix: do not modify the input packet upon encoding
Note: this issue has existed since Socket.IO v1.0 (see [1]), because the `deconstructPacket()` method also mutates its input argument. This also explains why some adapters (like [2]) need to use `process.nextTick()` when extending the `broadcast()` method, because `Adapter.broadcast()` calls `Encoder.encode()` ([3]). Related: - https://github.com/socketio/socket.io/issues/4374 - https://github.com/socketio/socket.io-mongo-adapter/issues/10 [1]: https://github.com/socketio/socket.io-parser/commit/299849b00294c3bc95817572441f3aca8ffb1f65 [2]: https://github.com/socketio/socket.io-postgres-adapter/blob/0.3.0/lib/index.ts#L587-L590 [3]: https://github.com/socketio/socket.io-adapter/blob/2.4.0/lib/index.ts#L148
D
Damien Arrachequesne committed
ae8dd88995dbd7f89c97e5cc15e5b489fa0efece
Parent: 9143aa4