From 2671dda661078050685a19dc5f391ac76b09289e Mon Sep 17 00:00:00 2001 From: jusax23 Date: Wed, 8 Mar 2023 17:21:29 +0100 Subject: [PATCH] bug fix --- src/api/ws.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/ws.ts b/src/api/ws.ts index 3d815da..96e508e 100644 --- a/src/api/ws.ts +++ b/src/api/ws.ts @@ -38,7 +38,7 @@ export class wsClient { let msgStr = msg.toString(); debug("WebSocket", "reveived:", msgStr); let json = JSON.parse(msgStr) as { act: string, id: number, data: any }; - if (closed) { + if (!this.open) { socket.send(JSON.stringify({ id: json.id, state: "error", @@ -131,6 +131,7 @@ export class wsClient { }); socket.on('close', () => { + this.open = false; var i = clients.indexOf(this); delete clients[i]; if (i >= 0) {