relay: only send if socket is open

This commit is contained in:
Alex Gleason
2023-08-25 15:00:48 -05:00
parent f7cd67c572
commit b60e84d29b
2 changed files with 3 additions and 2 deletions

View File

@@ -90,7 +90,9 @@ function connectStream(socket: WebSocket) {
/** Send a message back to the client. */
function send(msg: RelayMsg): void {
return socket.send(JSON.stringify(msg));
if (socket.readyState === WebSocket.OPEN) {
socket.send(JSON.stringify(msg));
}
}
}