diff --git a/receivers/common/web/TcpListenerService.ts b/receivers/common/web/TcpListenerService.ts index beb9c14..ef98273 100644 --- a/receivers/common/web/TcpListenerService.ts +++ b/receivers/common/web/TcpListenerService.ts @@ -48,7 +48,7 @@ export class TcpListenerService { } disconnect(connectionId: string) { - this.sessionMap[connectionId].socket.destroy(); + this.sessionMap[connectionId]?.socket.destroy(); } private async handleServerError(err: NodeJS.ErrnoException) { diff --git a/receivers/common/web/WebSocketListenerService.ts b/receivers/common/web/WebSocketListenerService.ts index b37b122..b36c4e7 100644 --- a/receivers/common/web/WebSocketListenerService.ts +++ b/receivers/common/web/WebSocketListenerService.ts @@ -47,7 +47,7 @@ export class WebSocketListenerService { } disconnect(connectionId: string) { - this.sessionMap[connectionId].close(); + this.sessionMap[connectionId]?.close(); } private async handleServerError(err: NodeJS.ErrnoException) {