Skip to content

Commit

Permalink
fix: the server could crash if a client sends invalid frames
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasgloning committed Nov 17, 2022
1 parent 3165d77 commit 29394de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/webSocketServer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class WebSocketServer extends EventEmitter implements IWebSocketServer {
}

private _onSocketConnection(socket: WebSocket, req: IncomingMessage): void {
// An unhandled socket error might crash the server. Handle it first.
socket.on("error", error => this._onSocketError(error))

const { query = {} } = url.parse(req.url ?? '', true);

const { id, token, key }: IAuthParams = query;
Expand Down

0 comments on commit 29394de

Please sign in to comment.