Check WS process message before ping
MODIFY
src/server/ocpp/json/JsonCentralSystemServer.ts
src/server/ocpp/json/JsonCentralSystemServer.ts
@@ -58,11 +58,11 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
const ocppMessage = Utils.convertBufferArrayToString(message);
// Wait for Init
const processMessage = await this.waitForEndOfInitForOnMessage(ws, ocppMessage);
+ // Get the WS
+ if (processMessage) {
// Check if connection is still valid
const result = await this.isWebSocketValid(ws);
if (result.ok) {
- // Get the WS
- if (processMessage) {
const wsConnection = await this.getWSConnectionFromWebSocket(ws);
if (wsConnection) {
await wsConnection.onMessage(ocppMessage, isBinary);
@@ -392,13 +392,15 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
case Command.METER_VALUES:
case Command.UNLOCK_CONNECTOR:
case Command.RESERVE_NOW:
- case Command.STATUS_NOTIFICATION:
case Command.CHANGE_AVAILABILITY:
case Command.SET_CHARGING_PROFILE:
case Command.CLEAR_CHARGING_PROFILE:
case Command.GET_COMPOSITE_SCHEDULE:
return `${ws.url as string}~${command}~${ocppParameter.connectorId}`;
+ case Command.STATUS_NOTIFICATION:
+ return `${ws.url as string}~${command}~${ocppParameter.connectorId}~${ocppParameter.status}`;
+
case Command.AUTHORIZE:
case Command.STOP_TRANSACTION:
return `${ws.url as string}~${command}~${ocppParameter.idTag}`;

Check WS process message before ping