From: Jérôme Benoit Date: Sun, 4 Sep 2022 11:59:47 +0000 (+0200) Subject: WS UI server: use error on socket destroy X-Git-Tag: v1.1.70~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5aefc345de84b04a0bd5529830948da4d5c2f547;p=e-mobility-charging-stations-simulator.git WS UI server: use error on socket destroy Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index b973cf45..c706cdd9 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -72,7 +72,7 @@ export default class UIWebSocketServer extends AbstractUIServer { this.authenticate(req, (err) => { if (err) { socket.write(`HTTP/1.1 ${StatusCodes.UNAUTHORIZED} Unauthorized\r\n\r\n`); - socket.destroy(); + socket.destroy(err); return; } this.webSocketServer.handleUpgrade(req, socket, head, (ws: WebSocket) => {