X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=72c781fc4ddf2b1a8b10b68f21c067ccb8ab938f;hb=d09085e9e6ec32bb1873b8f4cc1b326f7996d0f3;hp=e63e067de3d0f3549a0d0ef35007091573d43cb3;hpb=125ec3b6560ba032327557f0827620192a8aaca3;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index e63e067d..72c781fc 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -631,16 +631,16 @@ export default class ChargingStation { this.hasSocketRestarted = false; } - private async onClose(closeEvent: any): Promise { - switch (closeEvent) { + private async onClose(code: number): Promise { + switch (code) { case WebSocketCloseEventStatusCode.CLOSE_NORMAL: // Normal close case WebSocketCloseEventStatusCode.CLOSE_NO_STATUS: - logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(closeEvent)}'`); + logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); this.autoReconnectRetryCount = 0; break; default: // Abnormal close - logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(closeEvent)}'`); - await this.reconnect(closeEvent); + logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); + await this.reconnect(code); break; } } @@ -1035,7 +1035,7 @@ export default class ChargingStation { return !Utils.isUndefined(this.stationInfo.reconnectExponentialDelay) ? this.stationInfo.reconnectExponentialDelay : false; } - private async reconnect(error: Error): Promise { + private async reconnect(code: number): Promise { // Stop WebSocket ping this.stopWebSocketPing(); // Stop heartbeat