From: Jérôme Benoit Date: Tue, 28 Sep 2021 18:04:01 +0000 (+0200) Subject: Ensure the OCPP message sending stop if the WS is not open X-Git-Tag: v1.1.14~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=65334d061f549a3136373b27c35cb0e508c75a9f;hp=3d0af7b825eac2bd55bdb9ba1e2dd5dbc9a0c699;p=e-mobility-charging-stations-simulator.git Ensure the OCPP message sending stop if the WS is not open Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 43e41025..ffe9f920 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -43,7 +43,7 @@ export default abstract class OCPPRequestService { // Buffer it this.chargingStation.addToMessageQueue(messageToSend); // Reject it but keep the request in the cache - reject(new OCPPError(commandParams?.code ?? ErrorType.GENERIC_ERROR, commandParams?.message ?? `WebSocket closed for message id '${messageId}' with content '${messageToSend}', message buffered`, commandParams?.details ?? {})); + return reject(new OCPPError(commandParams?.code ?? ErrorType.GENERIC_ERROR, commandParams?.message ?? `WebSocket closed for message id '${messageId}' with content '${messageToSend}', message buffered`, commandParams?.details ?? {})); } // Response? if (messageType !== MessageType.CALL_MESSAGE) {