WS UI Server: do not crash the server at authentication error
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 12:43:50 +0000 (14:43 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 12:43:50 +0000 (14:43 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ui-server/UIWebSocketServer.ts

index f7a0379dc4bcd12dffcc9249e67bda17f6f5941d..01c57800a293c5d3d9da411812ee6d0388e63f16 100644 (file)
@@ -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(err);
+            socket.destroy();
             return;
           }
           this.webSocketServer.handleUpgrade(req, socket, head, (ws: WebSocket) => {