this.getConnectorStatus(connectorId).status = ChargePointStatus.UNAVAILABLE;
}
}
- if (this.isWebSocketConnectionOpened()) {
- this.wsConnection.close();
- }
+ this.closeWSConnection();
if (this.getEnableStatistics()) {
this.performanceStatistics.stop();
}
): void {
options.handshakeTimeout = options?.handshakeTimeout ?? this.getConnectionTimeout() * 1000;
params.closeOpened = params?.closeOpened ?? false;
- params.terminateOpened = params?.closeOpened ?? false;
+ params.terminateOpened = params?.terminateOpened ?? false;
if (
!Utils.isNullOrUndefined(this.stationInfo.supervisionUser) &&
!Utils.isNullOrUndefined(this.stationInfo.supervisionPassword)
) {
options.auth = `${this.stationInfo.supervisionUser}:${this.stationInfo.supervisionPassword}`;
}
- if (this.isWebSocketConnectionOpened() && params?.closeOpened) {
- this.wsConnection.close();
+ if (params?.closeOpened) {
+ this.closeWSConnection();
}
- if (this.isWebSocketConnectionOpened() && params?.terminateOpened) {
- this.wsConnection.terminate();
+ if (params?.terminateOpened) {
+ this.terminateWSConnection();
}
let protocol: string;
switch (this.getOcppVersion()) {
);
}
+ private closeWSConnection(): void {
+ if (this.isWebSocketConnectionOpened()) {
+ this.wsConnection.close();
+ this.wsConnection = null;
+ }
+ }
+
+ private terminateWSConnection(): void {
+ if (this.isWebSocketConnectionOpened()) {
+ this.wsConnection.terminate();
+ this.wsConnection = null;
+ }
+ }
+
private stopMeterValues(connectorId: number) {
if (this.getConnectorStatus(connectorId)?.transactionSetInterval) {
clearInterval(this.getConnectorStatus(connectorId).transactionSetInterval);