Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a window for heartbeat pings and pongs #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

inhies
Copy link

@inhies inhies commented Jun 9, 2013

I was having issues with my test system cosing the connection due to imprecise timing for the heartbeats. If the client using stomp.js says it will send a heartbeat every 10 seconds, the server killed the connection as soon as 10 seconds has elapsed. This was a problem because stomp.js was setting a timer for 10 seconds exactly but it wasn't sending the heartbeat in time.

The heartbeatWindow value allows you to specify a percentage difference. By default I set it to 10 percent, which will send a heartbeat every 9 seconds and expect a heartbeat every 11 seconds, if using the default 10 second values for the heartbeat negotiation.

@jmesnil
Copy link
Owner

jmesnil commented Jul 17, 2013

it's not necessary to modify the timeout value for the heart-beat received from the broker, the library is tolerant and will not report a connection issue before 2 missing heart-beats (see https://github.com/jmesnil/stomp-websocket/blob/master/src/stomp.coffee#L143)

If you modify your commit to only apply the heartbeatWindow to the heart-beat sent by the client, I will merge it.

TrevorRawlings pushed a commit to TrevorRawlings/stomp-websocket that referenced this pull request Jan 8, 2015
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.

2 participants