- response = (await this.incomingRequestHandlers.get(commandName)!(
- chargingStation,
- commandPayload
- )) as ResType
- this.emit(commandName, chargingStation, commandPayload, response)
+ const incomingRequestHandler = this.incomingRequestHandlers.get(commandName)!
+ if (isAsyncFunction(incomingRequestHandler)) {
+ response = (await incomingRequestHandler(chargingStation, commandPayload)) as ResType
+ } else {
+ response = incomingRequestHandler(chargingStation, commandPayload) as ResType
+ }