X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2FChargingStation.ts;h=103a96f0bdc970b003169adccb801009a4d1c57b;hb=6c65a2958d57b4c91a60150c2bf567659b64d4f0;hp=72c781fc4ddf2b1a8b10b68f21c067ccb8ab938f;hpb=247f55f4b67f4ed161ed6b2d8f076c65b52a7038;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 72c781fc..103a96f0 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -631,15 +631,17 @@ export default class ChargingStation { this.hasSocketRestarted = false; } - private async onClose(code: number): Promise { + private async onClose(code: number, reason: string): Promise { switch (code) { - case WebSocketCloseEventStatusCode.CLOSE_NORMAL: // Normal close + // Normal close + case WebSocketCloseEventStatusCode.CLOSE_NORMAL: case WebSocketCloseEventStatusCode.CLOSE_NO_STATUS: - logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); + logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); this.autoReconnectRetryCount = 0; break; - default: // Abnormal close - logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); + // Abnormal close + default: + logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)} and reason '${reason}'`); await this.reconnect(code); break; }