Fix rapid reconnect issue for shared clients #55
Merged
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.
This PR fixes a race condition issue for clients that use a shared client. The issue happened when the reconnect was called repeatedly on multiple clients over and over again as a group.
Note
Implements idempotent
reconnect()inSharedCentrifugeand updatesWebSocketTransportto use it when sharing connections, with new unit/integration tests; minor demo tweaks.reconnect()topackages/core/src/transport/websocket/shared-centrifuge.tsusing a sharedreconnectPromiseto prevent connection storms.packages/core/src/transport/websocket/index.tsreconnect()to delegate toSharedCentrifuge.reconnect()when using shared connections; fallback for non-shared.shared-centrifuge.test.tscovering reconnect idempotency, concurrent/rapid calls, and edge cases.shared-centrifuge.integration.test.tswith scenarios for simultaneous and rapid reconnect cycles.apps/web-demo/src/components/MetaMaskMobileDemo.tsxandNavigation.tsx.apps/web-demo/src/lib/encoding-utils.ts.Written by Cursor Bugbot for commit 3930f1f. This will update automatically on new commits. Configure here.