X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;fp=src%2Fcharging-station%2FChargingStation.ts;h=080349eae731cbe27e9ba6b00354da0d40a66f7e;hb=8fa6f565c86b72f3d6f040d283da83740a51542e;hp=c31c00f7b49343b8b3f92f0e15daeb34e0b8c5ce;hpb=88dce0e10e9f3b8f5d65ff990b584c34e6ddb3eb;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index c31c00f7..080349ea 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -261,14 +261,15 @@ export class ChargingStation extends EventEmitter { } public get wsConnectionUrl (): URL { + const wsConnectionBaseUrlStr = `${ + this.stationInfo?.supervisionUrlOcppConfiguration === true && + isNotEmptyString(this.stationInfo.supervisionUrlOcppKey) && + isNotEmptyString(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey)?.value) + ? getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey)?.value + : this.configuredSupervisionUrl.href + }` return new URL( - `${ - this.stationInfo?.supervisionUrlOcppConfiguration === true && - isNotEmptyString(this.stationInfo.supervisionUrlOcppKey) && - isNotEmptyString(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey)?.value) - ? getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey)?.value - : this.configuredSupervisionUrl.href - }/${this.stationInfo?.chargingStationId}` + `${wsConnectionBaseUrlStr}${!wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''}${this.stationInfo?.chargingStationId}` ) }