webcontainer-core
webcontainer-core copied to clipboard
WebSocket client + arraybuffer binaryType issue
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
- Start the http/ws server
- Open the "/" URL in the browser
- See the console logs on the browser's Developer Tools
- You will notice that received bytes differ depending on the
binaryTypeused ("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
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!
https://github.com/websockets/ws/issues/1175 It might be helpful
It has been 10 months. Please resolve this issue quickly.