WebSocket refusing to connect (1006)

HTTP error 500, WS error 1006 Server code:
const pair = new WebSocketPair();
const [client, server] = Object.values(pair);
this.ctx.acceptWebSocket(server);
this.clients.push(client);
const pair = new WebSocketPair();
const [client, server] = Object.values(pair);
this.ctx.acceptWebSocket(server);
this.clients.push(client);
Dashboard shows You must call one of accept() or state.acceptWebSocket() on this WebSocket before sending messages. (i called that method) Client implementation works, tested with wrangler/another websocket server
No description
1 Reply
Cane1712
Cane1712OP2w ago
No clue what this one could be... If it matters, the client implementation's just
const ws = new WebSocket("wss://some-worker.workers.dev/ws")
//...
if (ws.readyState == WebSocket.OPEN) ws.send("some data")
const ws = new WebSocket("wss://some-worker.workers.dev/ws")
//...
if (ws.readyState == WebSocket.OPEN) ws.send("some data")

Did you find this page helpful?