We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Server cannot receives Uint8Array from client, it only receives a plain Object.
Client side:
let binary = new Uint8Array(5); binary.fill(12); socket.emit('binary', binary);
Server side:
socket.on('binary', (binaryData) => { console.log(binaryData); });
Result of console.log on Server side:
{ '0': 12, '1': 12, '2': 12, '3': 12, '4': 12, '5': 12 }
Server side receives a Buffer, an ArrayBuffer, or Uint8Array.
I don't know if this is a bug or not. Edit: Reason to do this: to save bandwidth.
The text was updated successfully, but these errors were encountered:
let binary = new Uint8Array(5); binary.fill(12); let buffer = binary.buffer.slice(binary.byteOffset, binary.byteOffset + binary.byteLength); socket.emit('binary', buffer);
const toArrayBuffer = require('to-arraybuffer'); let binary = new Uint8Array(5); binary.fill(12); let buffer = toArrayBuffer(binary); socket.emit('binary', buffer);
Sorry, something went wrong.
This was fixed by socketio/socket.io-parser@8822578, included in socket.io-parser@3.1.3 & socket.io@2.0.4.
socket.io-parser@3.1.3
socket.io@2.0.4
No branches or pull requests
You want to:
Current behaviour
Server cannot receives Uint8Array from client, it only receives a plain Object.
Steps to reproduce (if the current behaviour is a bug)
Client side:
Server side:
Result of console.log on Server side:
Expected behaviour
Server side receives a Buffer, an ArrayBuffer, or Uint8Array.
Setup
Other information (e.g. stacktraces, related issues, suggestions how to fix)
I don't know if this is a bug or not.
Edit: Reason to do this: to save bandwidth.
The text was updated successfully, but these errors were encountered: