Repository navigation
fix: websocket close code, don't kill connecting sockets on online, single keepalive frame - #175
Merged
Merged
Conversation
…ingle keepalive frame Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Server-side churn data shows browser SDK sockets are under 1% of short-lived websocket connections, so the impact is small. This change still removes the 1005 ("no status") closes the server records for the SDK's own disconnects, and it stops needless reconnects.
Changes (
src/GleapStreamedEvent.js)cleanupWebSocket()now closes withclose(1000, 'client closing')instead of a bareclose(). Every intentional close goes through it: restart on gleapId change,stop()/destroy, and the reconnect paths. The call is wrapped in try/catch.onlinehandler: it now reconnects only when there is no socket or the socket is CLOSING/CLOSED. Before, it reconnected unless the socket was OPEN, which killed a socket that was still CONNECTING.'PING'text frame every 25 s. Before, it sent two frames every 10 s:'PING'plus a stray0x9, which went out as the text"9".Server/src/api/websocket/server.ts) registers nomessagelistener on client sockets, so it ignores both frames.this.socket.this.socket.OPEN.restart(): unchanged. It already reconnects only when the gleapId changed, andstop()resetsconnectedWebSocketGleapId.No version bump and no release. The
build/andpublished/bundles are not touched.Tests
npm test: 31 suites and 524 tests pass, including the existingGleapStreamedEventreconnect tests (online/offline, SDK closes never reconnect, single pending reconnect).npm run build: compiles, with 3 warnings that were already there.🤖 Generated with Claude Code