webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

WebSocket client + arraybuffer binaryType issue

Open endel opened this issue 2 years ago • 3 comments

Description of Bug

The WebSocket client doesn't seem to be receiving the payload correctly when using .binaryType = "arraybuffer".

https://stackblitz.com/edit/stackblitz-starters-uuauht?file=public%2Findex.html

Steps to Reproduce

  1. Start the http/ws server
  2. Open the "/" URL in the browser
  3. See the console logs on the browser's Developer Tools
  4. You will notice that received bytes differ depending on the binaryType used ("blob" receives correctly, whereas "arraybuffer" seems to be receiving additional bytes)
Received bytes (arraybuffer): [130, 1, 10]
Received bytes (blob): [10]

Expected Behavior

Both WebSocket client connections should be receiving the exact data sent by the server ([10])

Received bytes (arraybuffer): [10]
Received bytes (blob): [10]

Screenshots/Screencast

Screenshot 2023-09-15 at 16 13 13

endel avatar Sep 15 '23 19:09 endel

Hi @endel ! Thank you so much for the minimal reproduction link! :star2: Super cool :smiley:

We'll investigate, our support for arraybuffer might be buggy.

I'll keep you posted!

Nemikolh avatar Sep 15 '23 20:09 Nemikolh

https://github.com/websockets/ws/issues/1175 It might be helpful

terry-fei avatar Feb 03 '24 08:02 terry-fei

It has been 10 months. Please resolve this issue quickly.

remocons avatar Jun 29 '24 16:06 remocons