-
-
Notifications
You must be signed in to change notification settings - Fork 66
fix: Add heartbeat callback; Move to Sets vs Arrays #460
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Co-authored-by: Copilot <[email protected]>
…a Heartbeat status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a heartbeat callback mechanism and refactors channel storage from arrays to Sets within the RealtimeClient, along with updating the tests accordingly.
- Updates test assertions to use the new getChannels() helper instead of directly accessing the channels property.
- Implements heartbeat callback functionality with additional tests for both successful and error heartbeats.
- Refactors channel creation and removal logic to work with a Set instead of an array.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
test/client.test.ts | Updated test assertions to retrieve channels via getChannels() and added heartbeat tests. |
test/channel.test.ts | Updated channel removal assertions to use getChannels(). |
src/RealtimeClient.ts | Changed channels from an array to a Set; added HeartbeatStatus type and heartbeat callback methods; updated channel creation and removal logic. |
Comments suppressed due to low confidence (1)
src/RealtimeClient.ts:426
- There is a spelling mistake in the error message ('hearbeat timeout'). It should be corrected to 'heartbeat timeout'.
this.conn?.close(WS_CLOSE_NORMAL, 'hearbeat timeout')
What kind of change does this PR introduce?
Add heartbeat callback; Move to Sets vs Arrays