mokyu
mokyu
DDeno
Created by mokyu on 10/14/2023 in #help
When the destination server is down, WebSocketStream stops and the program crashes.
I'm running the following code:
const ws = new WebSocketStream("wss://localhost");

setInterval(() => {
console.log("test...");
}, 500);
const ws = new WebSocketStream("wss://localhost");

setInterval(() => {
console.log("test...");
}, 500);
When the localhost server is down, the code crashes and stops. With a normal WebSocket, it continues to run without stopping. How can I make it run continuously without stopping?
2 replies
DDeno
Created by mokyu on 10/3/2023 in #help
Can someone explain WebSocketStream to me?
Whenever I try to connect using WebSocketStream and the host doesn't respond, my program inevitably crashes and stops. I'd like to have the program attempt to reconnect without stopping even if an error occurs, but I can't seem to make it work. Does anyone have a solution for this? function webSocketStream_Connection() { try { const wss = new WebSocketStream("wss://localhost") } catch (err) { setTimeout(() => webSocketStream_Connection(), 5) } } webSocketStream_Connection() error: Uncaught (in promise) ConnectionRefused: 対象のコンピューターによって拒否されたため、接続できませんでした。 (os error 10061)
4 replies