bun
bun copied to clipboard
WebSocket - close 1002 Protocol error - expected control frame
What version of Bun is running?
0.3.0
What platform is your computer?
Darwin 22.1.0 x86_64 i386
What steps can reproduce the bug?
const ws = new WebSocket("wss://gateway.discord.gg/?version=10&encoding=json")
ws.addEventListener("open", () => {
console.log("open")
})
ws.addEventListener("message", (e) => {
console.log("message", e.data)
})
ws.addEventListener("error", (e) => {
console.log("error", e)
})
ws.addEventListener("close", (e) => {
console.log("close", e.code, e.reason)
})
What is the expected behavior?
No response
What do you see instead?

Additional information
No response
Confirmed by me.
Doesn't seem to repro on my home internet on either macOS aarch64 or Linux x64
Will try more configurations
It happens me when i connect like 10 accounts to discord gateway.
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: https://github.com/oven-sh/bun/issues/6686