Skip to content

feat: support dynamic heartbeat lookup - #756

Open
cdaringe wants to merge 7 commits into
stomp-js:developfrom
cdaringe:feat/dyn-hb-tol
Open

cdaringe wants to merge 7 commits into
stomp-js:developfrom
cdaringe:feat/dyn-hb-tol

Conversation

@cdaringe

@cdaringe cdaringe commented Nov 3, 2026 •

Copy link
Copy Markdown

Summary

  • Allow heartbeatToleranceMultiplier to be a number or synchronous lookup callback
  • Evaluate the callback on every incoming heartbeat check so tolerance can adapt without reconnecting

Closes #755

Validation

Unit tests only

Comment thread src/types.ts Resolved
Comment thread spec/unit/heart-beat-callback.spec.ts Resolved
@cdaringe
cdaringe marked this pull request as ready for review November 3, 2026 23:46
Comment thread src/client.ts Resolved
@kum-deepak

Copy link
Copy Markdown
Member

Many thanks for the PR. I have reviewed it, and I have no feedback on the code itself apart from the one in the review comment.

I would, however, redo the tests. Currently, the approach to testing a similar feature is to create a wrapper socket-like object over the real WebSocket and alter behavior as needed. I will not like to introduce another code pattern.

Since you used AI to generate the test cases, please regenerate the test file based on https://github.com/stomp-js/stompjs/blob/develop/spec/unit/heart-beat.spec.ts

If any of my remarks are unclear, please let me know.

@cdaringe
cdaringe requested a review from kum-deepak November 13, 2026 17:46
@cdaringe

cdaringe commented Nov 14, 2026 •

Copy link
Copy Markdown
Author

should be g2g!

one thing i didnt address are the duration for which the timer fires. I may send a subsequent refinement PR after this. The hb duration is ~ duration = fn(negotiated_heartbeat, tolerance) , but I think the timer is more or less fixed today. It could benefit from more dynamic duration given the HB tolerance can now be specified more dynamically.

This branch has not been deployed

No deployments
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.

RFC: Dynamic heartbeatTolerance lookup

2 participants