Skip to content

Conversation

@chakra-guy
Copy link
Collaborator

@chakra-guy chakra-guy commented Oct 10, 2025

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() in SharedCentrifuge and updates WebSocketTransport to use it when sharing connections, with new unit/integration tests; minor demo tweaks.

  • Core (WebSocket)
    • Add idempotent reconnect() to packages/core/src/transport/websocket/shared-centrifuge.ts using a shared reconnectPromise to prevent connection storms.
    • Update packages/core/src/transport/websocket/index.ts reconnect() to delegate to SharedCentrifuge.reconnect() when using shared connections; fallback for non-shared.
  • Tests
    • Add unit tests shared-centrifuge.test.ts covering reconnect idempotency, concurrent/rapid calls, and edge cases.
    • Extend integration tests shared-centrifuge.integration.test.ts with scenarios for simultaneous and rapid reconnect cycles.
  • Web Demo
    • Minor UI/template tweaks and updated hardcoded accounts in apps/web-demo/src/components/MetaMaskMobileDemo.tsx and Navigation.tsx.
    • Quote/style normalization in apps/web-demo/src/lib/encoding-utils.ts.

Written by Cursor Bugbot for commit 3930f1f. This will update automatically on new commits. Configure here.

@chakra-guy chakra-guy merged commit 7af58cd into main Oct 13, 2025
12 checks passed
@chakra-guy chakra-guy deleted the fix-rapid-reconnect-issue-for-shared-clients branch October 13, 2025 07:49
@chakra-guy chakra-guy mentioned this pull request Oct 13, 2025
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.

3 participants