From 33e6d755cc8511954ac0094cb28ae92af95cfe12 Mon Sep 17 00:00:00 2001 From: Jonas Gloning <34194370+jonasgloning@users.noreply.github.com> Date: Fri, 4 Nov 2022 21:53:48 +0100 Subject: [PATCH] fix: the server could crash if a client sends invalid frames Closes #290 --- src/services/webSocketServer/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/webSocketServer/index.ts b/src/services/webSocketServer/index.ts index d9f2c5e7e..250c6b4ab 100644 --- a/src/services/webSocketServer/index.ts +++ b/src/services/webSocketServer/index.ts @@ -47,6 +47,7 @@ export class WebSocketServer extends EventEmitter implements IWebSocketServer { } private _onSocketConnection(socket: MyWebSocket, req: IncomingMessage): void { + socket.on("error", this._onSocketError); const { query = {} } = url.parse(req.url ?? '', true); const { id, token, key }: IAuthParams = query;