mokyu
mokyu
DDeno
Created by mokyu on 10/3/2023 in #help
Can someone explain WebSocketStream to me?
I've tried the following code: However, I'm getting an error and the program stops before it retries the connection.
async function webSocketStream_Connection() {
try {
const wss = new WebSocketStream("wss://localhost");
const { writable, readable } = await wss.connection;
// Connection established, you can now use `writable` and `readable`
} catch (err) {
console.error("Failed to connect, retrying in 5 seconds", err);
setTimeout(webSocketStream_Connection, 5000);
}
}
webSocketStream_Connection();
async function webSocketStream_Connection() {
try {
const wss = new WebSocketStream("wss://localhost");
const { writable, readable } = await wss.connection;
// Connection established, you can now use `writable` and `readable`
} catch (err) {
console.error("Failed to connect, retrying in 5 seconds", err);
setTimeout(webSocketStream_Connection, 5000);
}
}
webSocketStream_Connection();
4 replies