Remove useless condition test
[e-mobility-charging-stations-simulator.git] / src / charging-station / Bootstrap.ts
index 06bc50e391695090eb25d6e469a98c5e5be7ce3d..fe344407dc03400970fc89fb911f45011ce422b5 100644 (file)
@@ -109,7 +109,11 @@ export default class Bootstrap {
           workerChoiceStrategy: Configuration.getWorkerPoolStrategy()
         },
         messageHandler: async (msg: ChargingStationWorkerMessage) => {
-          if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {
+          if (msg.id === ChargingStationWorkerMessageEvents.STARTED) {
+            this.webSocketServer.webSocketServerService.chargingStations.add(msg.data.id);
+          } else if (msg.id === ChargingStationWorkerMessageEvents.STOPPED) {
+            this.webSocketServer.webSocketServerService.chargingStations.delete(msg.data.id);
+          } else if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {
             await this.storage.storePerformanceStatistics(msg.data);
           }
         }