-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socket.onAnyOutgoing() cannot receive binary when it uses room #4374
Comments
Hi! I could indeed reproduce the issue. It's because the object is edited in place when encoding: https://github.com/socketio/socket.io-adapter/blob/b92d65cf9c6124930fac78349e2a0b847fe19f16/lib/index.ts#L148 Not sure if we can fix this without losing some performance on the table. |
Thanks for the reply! This problem seems to be difficult to fix. |
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: - socketio/socket.io#4374 - socketio/socket.io-mongo-adapter#10 [1]: 299849b [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
Update: this should be fixed in latest release, see socketio/socket.io-parser@ae8dd88. Please reopen if needed. |
Describe the bug
I want to use
socket.onAnyOutgoing()
to calculate bytes of outgoing messages.However, when I use a room and send a binary message,
socket.onAnyOutgoing()
cannot receive it.So, I cannot calculate correctly.
I can reproduce it with the following code.
To Reproduce
Socket.IO server version:
4.5.0
Server
Expected behavior
socket.onAnyOutgoing()
should receive correctly binary message when it uses room.Platform:
The text was updated successfully, but these errors were encountered: