From 3a9e47847e239c43ba707065c38dd3979ff29d3a Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Tue, 17 Jan 2023 15:24:42 +0100 Subject: [PATCH] [price-service] Handle WS error --- price-service/src/ws.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/price-service/src/ws.ts b/price-service/src/ws.ts index 4885bd91f0..e788f33ef3 100644 --- a/price-service/src/ws.ts +++ b/price-service/src/ws.ts @@ -233,6 +233,10 @@ export class WebSocketAPI { this.aliveClients.add(ws); }); + ws.on("error", (err: Error) => { + logger.warn(`Err with client ${this.wsId.get(ws)}: ${err}`); + }); + ws.on("close", (_code: number, _reason: Buffer) => { logger.info(`client ${this.wsId.get(ws)} closed the connection.`); this.promClient?.addWebSocketInteraction("close", "ok");