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

Only setup ws client heartbeat once it is connected #3344

Merged
merged 1 commit into from
Jan 12, 2022
Merged

Conversation

knolleary
Copy link
Member

  • Bugfix (non-breaking change which fixes an issue)

Proposed changes

Fixes #3264

The WebSocket Client heartbeat interval was being setup before the socket's open event fired - meaning it could try to send a ping before the client connected.

This fix moves the setup of the heartbeat to the open event handler and adds error handling around the ping() call to ensure it can't error if it hits a timing window of triggering whilst the socket is closing.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.009%) to 67.403% when pulling 036a825 on fix-ws-hb into 6d2793c on master.

@dceejay
Copy link
Member

dceejay commented Jan 12, 2022

👍

@knolleary knolleary merged commit 48fb1a8 into master Jan 12, 2022
@knolleary knolleary deleted the fix-ws-hb branch January 12, 2022 22:53
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.

Websocket In Node with hearbeat causes crash if target disconnects
3 participants