Skip to content
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.io sends binary data larger than the size of the sending JSON! #3458

Closed
ghost opened this issue Jun 19, 2019 · 0 comments
Closed

Socket.io sends binary data larger than the size of the sending JSON! #3458

ghost opened this issue Jun 19, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 19, 2019

QQ截图20190620025919
I found that when sending binary data, it automatically sends a JSON first, and the first byte at the beginning is fixed at 04.
Online games send 60 frames of data per second, which will be very large, at least 2KB was wasted per second. Is there a way to not send that JSON automatically?

socket.on('connect', function () {
socket.emit('init',[1,2,3]);
});

io.on('connection', function (socket) {
socket.emit("foo",new Uint8Array([1,2,3]).buffer);
socket.emit("foo",new Uint8Array([1,2,3]).buffer);
});

"socket.io": "^2.2.0"

@ghost ghost closed this as completed Jan 4, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants