Problem
The OCPP server closes a connection after 5 minutes without an OCPP message (IDLE_TIMEOUT_MS in ocpp-server.ts). The BootNotification response hands out a heartbeat interval of 300 s, i.e. exactly the same time.
A station that keeps that interval exactly has its heartbeat arrive a few milliseconds after the idle timer fired. We see this with a KEBA KC-P30 (OCPP 1.6J): while idle it is disconnected every 5 to 10 minutes (heartbeat answered at 17:38:49.298, close at 17:38:49.413, the same pattern every cycle) and reconnects about a minute later. During that minute the station is unreachable for remote commands.
Proposed fix (PR follows)
Count WebSocket ping and pong frames as activity. The ping monitor pings every station every 30 s, so pongs keep live connections open, and stations that ping on their own schedule (e.g. KEBA WebSocketPingInterval) are covered as well. Only connections without any sign of life are closed. Make the timeout configurable (OCPP_IDLE_TIMEOUT_MS, default unchanged).
Problem
The OCPP server closes a connection after 5 minutes without an OCPP message (
IDLE_TIMEOUT_MSinocpp-server.ts). The BootNotification response hands out a heartbeat interval of 300 s, i.e. exactly the same time.A station that keeps that interval exactly has its heartbeat arrive a few milliseconds after the idle timer fired. We see this with a KEBA KC-P30 (OCPP 1.6J): while idle it is disconnected every 5 to 10 minutes (heartbeat answered at 17:38:49.298, close at 17:38:49.413, the same pattern every cycle) and reconnects about a minute later. During that minute the station is unreachable for remote commands.
Proposed fix (PR follows)
Count WebSocket ping and pong frames as activity. The ping monitor pings every station every 30 s, so pongs keep live connections open, and stations that ping on their own schedule (e.g. KEBA
WebSocketPingInterval) are covered as well. Only connections without any sign of life are closed. Make the timeout configurable (OCPP_IDLE_TIMEOUT_MS, default unchanged).