- // Validate the raw data received from the WebSocket
- // TODO: should probably be moved to the ws verify clients callback
- private requestValidation(rawData: RawData | JsonType): ProtocolRequest {
- // logger.debug(
- // `${this.logPrefix(
- // moduleName,
- // 'requestValidation'
- // )} Data received in string format: ${rawData.toString()}`
- // );
-
- const data = JSON.parse(rawData.toString()) as JsonType[];
-
- if (Array.isArray(data) === false) {
- throw new BaseError('UI protocol request is not an array');
- }
-
- if (data.length !== 3) {
- throw new BaseError('UI protocol request is malformed');
+ protected sendBroadcastChannelRequest(
+ uuid: string,
+ procedureName: BroadcastChannelProcedureName,
+ payload: BroadcastChannelRequestPayload
+ ): void {
+ if (!Utils.isEmptyArray(payload.hashIds)) {
+ payload.hashIds = payload.hashIds
+ .map((hashId) => {
+ if (this.uiServer.chargingStations.has(hashId) === true) {
+ return hashId;
+ }
+ logger.warn(
+ `${this.logPrefix(
+ moduleName,
+ 'sendBroadcastChannelRequest'
+ )} Charging station with hashId '${hashId}' not found`
+ );
+ })
+ .filter((hashId) => hashId !== undefined);