Skip to content

Server cannot receives Uint8Array from client, it only receives a plain Object #3143

Closed
@Meigyoku-Thmn

Description

@Meigyoku-Thmn

You want to:

  • report a bug
  • request a feature

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:

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 }

Expected behaviour

Server side receives a Buffer, an ArrayBuffer, or Uint8Array.

Setup

  • OS: Windows 10
  • browser: Google Chrome and Mozilla Firefox, Nodejs v8.9.1
  • socket.io version: 2.0.4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions