X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=c4d9abb610f1dd8b73fa1b169a06078d2ff52f64;hb=ef7d8c218d85b3c9b76af6c8fc1f066a9127c268;hp=3f113359320723808ac546783e98b076bd658967;hpb=1cc4b9e0b92fd38761068134499f6cca051adfd3;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 3f113359..c4d9abb6 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -6,7 +6,7 @@ import path from 'path'; import { URL } from 'url'; import { parentPort } from 'worker_threads'; -import WebSocket, { Data, RawData } from 'ws'; +import WebSocket, { type RawData } from 'ws'; import BaseError from '../exception/BaseError'; import OCPPError from '../exception/OCPPError'; @@ -1402,7 +1402,7 @@ export default class ChargingStation { } } - private async onClose(code: number, reason: string): Promise { + private async onClose(code: number, reason: Buffer): Promise { switch (code) { // Normal close case WebSocketCloseEventStatusCode.CLOSE_NORMAL: @@ -1410,7 +1410,7 @@ export default class ChargingStation { logger.info( `${this.logPrefix()} WebSocket normally closed with status '${Utils.getWebSocketCloseEventStatusString( code - )}' and reason '${reason}'` + )}' and reason '${reason.toString()}'` ); this.autoReconnectRetryCount = 0; break; @@ -1419,7 +1419,7 @@ export default class ChargingStation { logger.error( `${this.logPrefix()} WebSocket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString( code - )}' and reason '${reason}'` + )}' and reason '${reason.toString()}'` ); this.started === true && (await this.reconnect()); break; @@ -1427,7 +1427,7 @@ export default class ChargingStation { parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(this)); } - private async onMessage(data: Data): Promise { + private async onMessage(data: RawData): Promise { let messageType: number; let messageId: string; let commandName: IncomingRequestCommand;