Nenc
Nenc
CDCloudflare Developers
Created by Nenc on 7/6/2024 in #workers-help
Is it possible to use WebSocket clients in workers?
ok, ik now
let resp = await fetch('https://<url>', {
headers: {
Upgrade: 'websocket',
},
});

let ws = resp.webSocket;
if (!ws) {
throw new Error("server didn't accept WebSocket");
}

ws.accept();
let resp = await fetch('https://<url>', {
headers: {
Upgrade: 'websocket',
},
});

let ws = resp.webSocket;
if (!ws) {
throw new Error("server didn't accept WebSocket");
}

ws.accept();
from https://discord.com/channels/595317990191398933/967783711955365899/997600406182035496
2 replies