Skip to content

OCPP: keep websocket alive between heartbeats - #33099

Merged
andig merged 2 commits into
masterfrom
ocpp-pingwait
Aug 23, 2026
Merged

OCPP: keep websocket alive between heartbeats#33099
andig merged 2 commits into
masterfrom
ocpp-pingwait

Conversation

@andig

@andig andig commented Aug 23, 2026

Copy link
Copy Markdown
Member

fixes #32236

The websocket server used the ocpp-go default PingWait of 60s while BootNotification requests a 60s heartbeat interval. Every received frame resets the read deadline, so an idle charger that does not send websocket pings has to deliver its heartbeat within exactly one deadline period.

Trace from the issue (MENNEKES AMTRON 4You, idle, heartbeat and clock-aligned meter values both at 60s and landing in the same second):

disc 13:19:48  last message 13:18:48
disc 13:28:48  last message 13:27:48
disc 13:40:48  last message 13:39:48
disc 16:06:49  last message 16:05:49

All 17 disconnects in the trace occur exactly 60s after the last received message, i.e. the central system closes the connection, not the charger.

Heartbeat interval and websocket timeout are now derived from one constant, with PingWait at three heartbeats.


🤖 Generated with Claude Code

fixes #32236

The websocket server used the ocpp-go default PingWait of 60s while
BootNotification requests a 60s heartbeat interval. Chargers that don't
send websocket pings therefore raced the read deadline and were
disconnected whenever heartbeat and meter values coincided.
@andig andig added bug Something isn't working devices Specific device support labels Aug 23, 2026
@andig
andig requested a review from premultiply August 23, 2026 09:10
@andig
andig enabled auto-merge (squash) August 23, 2026 09:11
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Aug 23, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@andig

This comment has been minimized.

@sourcery-ai
sourcery-ai Bot dismissed their stale review August 23, 2026 09:13

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@andig
andig merged commit af4d14f into master Aug 23, 2026
11 checks passed
@andig
andig deleted the ocpp-pingwait branch August 23, 2026 09:16
@github-actions

Copy link
Copy Markdown
Contributor

✅ Opened backport pull request on release/0.314.3: #33101

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

Labels

bug Something isn't working devices Specific device support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MENNEKES AMTRON 4You: OCPP connection lost after several days due to TriggerMessage(MeterValues) every 5 seconds?

2 participants