Skip to content

OCPP idle timeout disconnects stations whose heartbeat interval equals it #26

Description

@MarcoSpittka

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions