Skip to content

Make heartbeat:0 disable heartbeats#853

Merged
cressie176 merged 1 commit into
mainfrom
feat/heartbeat-zero
May 10, 2026
Merged

Make heartbeat:0 disable heartbeats#853
cressie176 merged 1 commit into
mainfrom
feat/heartbeat-zero

Conversation

@cressie176

@cressie176 cressie176 commented May 9, 2026

Copy link
Copy Markdown
Collaborator

BREAKING CHANGE — bump to v2.0.0.

heartbeat: 0 now correctly disables heartbeats, sending 0 in the ConnectionTuneOk frame regardless of the server's suggestion. This aligns with the AMQP 0-9-1 spec, which defines heartbeat=0 as "disabled".

Previously, 0 was passed through negotiate() which treated it as "no preference", causing the server's suggested value to be used instead. The code even had a comment acknowledging the correct intent: "0 means no heartbeat, rather than maximum period of heartbeating".

Migration: if you are passing heartbeat: 0 and want to preserve the old behaviour of accepting the server's value, omit the option or pass null instead.

Closes #467. Supersedes #469.

🤖 Generated with Claude Code

Previously, passing heartbeat:0 was indistinguishable from not setting a
heartbeat at all, because negotiate() treats 0 as "no preference". This
made it impossible to explicitly disable heartbeats from the client side.

Introduces null as the sentinel for "no preference" (accept server value)
and handles heartbeat:0 as an explicit instruction to disable heartbeats,
sending 0 in the ConnectionTuneOk frame regardless of the server's suggestion.

Fixes #467.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cressie176 cressie176 merged commit 97b9f26 into main May 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to disable heartbeats

1 participant