WS UI server: use error on socket destroy
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 11:59:47 +0000 (13:59 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 4 Sep 2022 11:59:47 +0000 (13:59 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ui-server/UIWebSocketServer.ts

index b973cf45b6663aa43be9fda38a2dd43ca04ad9a7..c706cdd9a31613422bd5a519dcfba365833115ed 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();
+            socket.destroy(err);
             return;
           }
           this.webSocketServer.handleUpgrade(req, socket, head, (ws: WebSocket) => {