body ?? Constants.EMPTY_FREEZED_OBJECT
)
)
+ .then((protocolResponse: ProtocolResponse) => {
+ if (Utils.isNullOrUndefined(protocolResponse)) {
+ this.sendResponse(protocolResponse);
+ }
+ })
.catch(Constants.EMPTY_FUNCTION);
});
} else {
}
const [requestId] = request as ProtocolRequest;
this.responseHandlers.set(requestId, ws);
- this.uiServices.get(version)?.requestHandler(request).catch(Constants.EMPTY_FUNCTION);
+ this.uiServices
+ .get(version)
+ ?.requestHandler(request)
+ .then((protocolResponse: ProtocolResponse) => {
+ if (!Utils.isNullOrUndefined(protocolResponse)) {
+ this.sendResponse(protocolResponse);
+ }
+ })
+ .catch(Constants.EMPTY_FUNCTION);
});
ws.on('error', (error) => {
logger.error(`${this.logPrefix(moduleName, 'start.ws.onerror')} WebSocket error:`, error);
errorDetails: (error as OCPPError).details,
};
}
- // Send response
if (!Utils.isNullOrUndefined(responsePayload)) {
- this.sendResponse(messageId, responsePayload);
return this.uiServer.buildProtocolResponse(messageId, responsePayload);
}
}
- public sendRequest(
- messageId: string,
- procedureName: ProcedureName,
- requestPayload: RequestPayload
- ): void {
- this.uiServer.sendRequest(
- this.uiServer.buildProtocolRequest(messageId, procedureName, requestPayload)
- );
- }
+ // public sendRequest(
+ // messageId: string,
+ // procedureName: ProcedureName,
+ // requestPayload: RequestPayload
+ // ): void {
+ // this.uiServer.sendRequest(
+ // this.uiServer.buildProtocolRequest(messageId, procedureName, requestPayload)
+ // );
+ // }
public sendResponse(messageId: string, responsePayload: ResponsePayload): void {
this.uiServer.sendResponse(this.uiServer.buildProtocolResponse(messageId, responsePayload));