X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2FUIWebSocketServer.ts;h=bf9eb8b3a66b753907d98a2df18120dcd25291ce;hb=0a376442c47f8e1c89cff78e822a936f3d4c783a;hp=5017b746fd5b12c09a5297a73c8dd860d7ef1e7c;hpb=60a743910478b70e39dcefa5e1b752ec8a93880e;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index 5017b746..bf9eb8b3 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -1,5 +1,5 @@ -import type { IncomingMessage } from 'http'; -import type { Duplex } from 'stream'; +import type { IncomingMessage } from 'node:http'; +import type { Duplex } from 'node:stream'; import { StatusCodes } from 'http-status-codes'; import WebSocket, { type RawData, WebSocketServer } from 'ws'; @@ -10,7 +10,7 @@ import { type UIServerConfiguration, WebSocketCloseEventStatusCode, } from '../../types'; -import { Utils, logger } from '../../utils'; +import { Constants, Utils, logger } from '../../utils'; import { AbstractUIServer, UIServerUtils } from '../internal'; const moduleName = 'UIWebSocketServer'; @@ -48,12 +48,7 @@ export class UIWebSocketServer extends AbstractUIServer { } const [requestId] = request as ProtocolRequest; this.responseHandlers.set(requestId, ws); - this.uiServices - .get(version) - ?.requestHandler(request) - .catch(() => { - /* Error caught by AbstractUIService */ - }); + this.uiServices.get(version)?.requestHandler(request).catch(Constants.EMPTY_FUNCTION); }); ws.on('error', (error) => { logger.error(`${this.logPrefix(moduleName, 'start.ws.onerror')} WebSocket error:`, error);