this.stopping = true;
await this.stopMessageSequence(reason);
this.closeWSConnection();
- this.wsConnectionRestarted = false;
if (this.getEnableStatistics()) {
this.performanceStatistics.stop();
}
} else if (this.webSocketPingSetInterval) {
logger.info(
this.logPrefix() +
- ' WebSocket ping every ' +
- Utils.formatDurationSeconds(webSocketPingInterval) +
- ' already started'
+ ' WebSocket ping already started every ' +
+ Utils.formatDurationSeconds(webSocketPingInterval)
);
} else {
logger.error(
? reconnectDelay - reconnectDelayWithdraw
: 0;
logger.error(
- `${this.logPrefix()} WebSocket: connection retry in ${Utils.roundTo(
+ `${this.logPrefix()} WebSocket connection retry in ${Utils.roundTo(
reconnectDelay,
2
)}ms, timeout ${reconnectTimeout}ms`
);
await Utils.sleep(reconnectDelay);
logger.error(
- this.logPrefix() +
- ' WebSocket: reconnecting try #' +
- this.autoReconnectRetryCount.toString()
+ this.logPrefix() + ' WebSocket connection retry #' + this.autoReconnectRetryCount.toString()
);
this.openWSConnection(
{ ...(this.stationInfo?.wsOptions ?? {}), handshakeTimeout: reconnectTimeout },
this.wsConnectionRestarted = true;
} else if (this.getAutoReconnectMaxRetries() !== -1) {
logger.error(
- `${this.logPrefix()} WebSocket reconnect failure: maximum retries reached (${
+ `${this.logPrefix()} WebSocket connection retries failure: maximum retries reached (${
this.autoReconnectRetryCount
- }) or retry disabled (${this.getAutoReconnectMaxRetries()})`
+ }) or retries disabled (${this.getAutoReconnectMaxRetries()})`
);
}
}
export default class UIService001 extends AbstractUIService {
constructor(uiServer: AbstractUIServer) {
super(uiServer, ProtocolVersion['0.0.1']);
- this.requestHandlers.set(
- ProcedureName.START_CHARGING_STATION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.STOP_CHARGING_STATION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.OPEN_CONNECTION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.CLOSE_CONNECTION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.START_TRANSACTION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.STOP_TRANSACTION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.AUTHORIZE,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.BOOT_NOTIFICATION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.STATUS_NOTIFICATION,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.HEARTBEAT,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
- this.requestHandlers.set(
- ProcedureName.METER_VALUES,
- this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
- );
+ for (const procedureName of Object.keys(
+ AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMap
+ ) as ProcedureName[]) {
+ this.requestHandlers.set(
+ procedureName,
+ this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
+ );
+ }
}
}