refactor: convert remote stop transaction to two stages request
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 2.0 / OCPP20IncomingRequestService.ts
index a11026d8c0068c49fcecbe5b348f92c2c7bec1a9..67f3a61b492529ca0a2ae2bb487200035ff59569 100644 (file)
@@ -95,7 +95,6 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
             chargingStation,
             commandPayload
           )) as ResType
-          this.emit(commandName, chargingStation, commandPayload, response)
         } catch (error) {
           // Log
           logger.error(
@@ -136,6 +135,8 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
       response,
       commandName
     )
+    // Emit command name event to allow delayed handling
+    this.emit(commandName, chargingStation, commandPayload, response)
   }
 
   private validatePayload (