TrueCrime
TrueCrime
CDCloudflare Developers
Created by TrueCrime on 12/8/2023 in #workers-help
websocket client doesn't work
Hi, I'm trying to create a websocket client to connect to binance but I can't get it to work. export default { async fetch(request) { const res = await fetch("wss://stream.binance.com:9443/ws/BTCUSDT@depth@1000ms", { headers: { Upgrade: "websocket" }, }); const webSocket = res.webSocket; webSocket.accept(); webSocket.addEventListener("message", (event) => { console.log(event.data); }); webSocket.send("Hello!"); // Above listener logs "Hello!" return new Response(); }, }; kj/async-io-win32.c++:982: warning: Bind address resolved to multiple addresses. Fetch API cannot load: wss://stream.binance.com:9443/ws/BTCUSDT@depth@1000ms what am i doing wrong? thanks
12 replies