X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=547a4f3693321bf271d23cdae07c6cb51df01876;hb=8ca6874c767f7068b101291232cf69b05bbd28c1;hp=84930a5f628be1f99ed0e010778b55474961729c;hpb=2cc5d5ec705dae9c7b88be0733dddc22d652a17e;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 84930a5f..547a4f36 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1,7 +1,7 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import crypto from 'crypto'; import fs from 'fs'; +import crypto from 'node:crypto'; import path from 'path'; import { URL } from 'url'; import { parentPort } from 'worker_threads'; @@ -65,6 +65,7 @@ import { type IncomingRequest, IncomingRequestCommand, type MeterValuesRequest, + type OutgoingRequest, RequestCommand, type ResponseCallback, type StatusNotificationRequest, @@ -769,6 +770,12 @@ export default class ChargingStation { this.messageBuffer.forEach((message) => { // TODO: evaluate the need to track performance this.wsConnection.send(message); + const [messageType] = JSON.parse(message) as OutgoingRequest | Response | ErrorResponse; + logger.debug( + `${this.logPrefix()} >> Buffered ${OCPPServiceUtils.getMessageTypeString( + messageType + )} payload sent: ${message}` + ); this.messageBuffer.delete(message); }); }