X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2FUIWebSocketServer.ts;h=bf0a6c444749201fe06d2cdcc6f24b10fa09582a;hb=4c6f35659fb67d395adc035ef80c566eb6eef79e;hp=1e1a372c698a941365df864aac280aa3bb32778c;hpb=776cdee38610a544b49add6a5fa96010faff5c4f;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 1e1a372c..bf0a6c44 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -4,13 +4,8 @@ import type { Duplex } from 'node:stream' import { StatusCodes } from 'http-status-codes' import { type RawData, WebSocket, WebSocketServer } from 'ws' -import { AbstractUIServer } from './AbstractUIServer.js' -import { - getProtocolAndVersion, - handleProtocols, - isProtocolAndVersionSupported -} from './UIServerUtils.js' import { + MapStringifyFormat, type ProtocolRequest, type ProtocolResponse, type UIServerConfiguration, @@ -18,13 +13,19 @@ import { } from '../../types/index.js' import { Constants, - JSONStringifyWithMapSupport, getWebSocketCloseEventStatusString, isNotEmptyString, - logPrefix, + JSONStringify, logger, + logPrefix, validateUUID } from '../../utils/index.js' +import { AbstractUIServer } from './AbstractUIServer.js' +import { + getProtocolAndVersion, + handleProtocols, + isProtocolAndVersionSupported +} from './UIServerUtils.js' const moduleName = 'UIWebSocketServer' @@ -136,7 +137,7 @@ export class UIWebSocketServer extends AbstractUIServer { if (this.hasResponseHandler(responseId)) { const ws = this.responseHandlers.get(responseId) as WebSocket if (ws.readyState === WebSocket.OPEN) { - ws.send(JSONStringifyWithMapSupport(response)) + ws.send(JSONStringify(response, undefined, MapStringifyFormat.object)) } else { logger.error( `${this.logPrefix(