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 client connection drops if an unknown opcode is received #1804

Closed
mia-z opened this issue Jan 16, 2023 · 2 comments
Closed

WebSocket client connection drops if an unknown opcode is received #1804

mia-z opened this issue Jan 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mia-z
Copy link

mia-z commented Jan 16, 2023

What version of Bun is running?

0.4.0

What platform is your computer?

Microsoft Windows NT 10.0.22000.0 x64

What steps can reproduce the bug?

  1. Using the global WebSocket implementation, create a Websocket connection
    const ws = new WebSocket("wss://arealwebsocket.url");

  2. Receive message that has an opcode that bun's global WebSocket implementation isn't familair with -- in my case I was receiving MessageEvent { type: "message", data: "unknown opcode 15" }

  3. After receiving the previous message, the connection will drop. Wrapping the callback in a try-catch block doesnt prevent the connection from dropping.

What is the expected behavior?

The connection should persist -- or at the very least throw an exception.

What do you see instead?

No response

Additional information

At first I thought opcode 15 was PING or PONG until I read rfc6455 about reserved WebSocket opcodes. I assume this problem is due to opcodes outside the reserved range (if they're implemented or handled in Bun/the wrapper).

@mia-z mia-z added the bug Something isn't working label Jan 16, 2023
@Jarred-Sumner
Copy link
Collaborator

Its a protocol error, disconnecting is the correct behavior

I think the bug here is an issue in Bun's implementation of the websocket client and not that it disconnects

@Electroid
Copy link
Contributor

We need to test our WebSocket client using the Autobahn test suite to fix these bugs, including this one. For updates, please upvote and subscribe to this issue: #6686

@Electroid Electroid closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
@Electroid Electroid marked this as a duplicate of #6686 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants