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

WebSocket binary frame - added additional 2bytes #1476

Open
1 task done
remocons opened this issue Jun 28, 2024 · 1 comment
Open
1 task done

WebSocket binary frame - added additional 2bytes #1476

remocons opened this issue Jun 28, 2024 · 1 comment

Comments

@remocons
Copy link

remocons commented Jun 28, 2024

Describe the bug

There is an issue with the binary frame data in the WebSocket messages sent from the server.
A 2-byte information starting with 0x82 is added in front of the data.

Hex 00 00 00 00 00 was sent, but hex 0x82 0x05 00 00 00 00 00 was received.

Link to the blitz that caused the error

https://stackblitz.com/~/github.com/remocons/ws-websocket-example?file=ws_server.js

Steps to reproduce

  • please open the example
  • click the [send binary frame: 5bytes] button => received data size is 7bytes instead 5bytes.
  • click the [request_4bytes] button => received data size is 6bytes instead 4bytes.
  • text message is okay.

Expected behavior

  • click the [send binary frame: 5bytes] button => received data size is 7bytes instead 5bytes.
  • click the [request_4bytes] button => received data size is 6bytes instead 4bytes.

Parity with Local

Screenshots

stackblitz

stackblitz-ws-websocket-example

codesandbox

codesandbox_ws-websocket-example

replit

replit_ws-websocket-example

3 screen shot: codesandbox vs replit vs stackblitz

Platform

Version = 1.84.0
Hash = 499be3932f50ab06349575b1c9042f95bc072a8b
WebContainer = 70dbe416

Browser name  = Chrome
Full version  = 126.0.0.0
Major version = 126
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 103522077,
  "usedJSHeapSize": 99367509,
  "jsHeapSizeLimit": 4294705152
}

Additional context

No response

@remocons
Copy link
Author

It appears that this issue was reported 10 months ago. #1182
However, it is surprising that it has not been resolved yet. Since it is merely an issue with the offset and size when transmitting arraybuffers, it seems to be a simple problem to fix. Most WebSocket examples use only text messages, so they may not recognize problems when communicating with binary data. I am developing an open-source library called iosignal that provides real-time binary communication using WebSockets, so solving this issue is very important. Although it could be replaced with a blob, there are compatibility issues with other standard environments, so I hope for a prompt fix in StackBlitz's webcontainer.

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

1 participant