- }
- }, (msg: WorkerMessage) => {
- if (msg.id === WorkerEvents.PERFORMANCE_STATISTICS) {
- Bootstrap.storage.storePerformanceStatistics(msg.data);
+ },
+ messageHandler: async (msg: ChargingStationWorkerMessage) => {
+ if (msg.id === ChargingStationWorkerMessageEvents.STARTED) {
+ this.uiWebSocketServer.chargingStations.add(msg.data.id as string);
+ } else if (msg.id === ChargingStationWorkerMessageEvents.STOPPED) {
+ this.uiWebSocketServer.chargingStations.delete(msg.data.id as string);
+ } else if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {
+ await this.storage.storePerformanceStatistics(msg.data as unknown as Statistics);
+ }