Skip to content

feat(pubsub): add FallbackPubSubConnect for multi-endpoint reconnection#3833

Open
smuu wants to merge 2 commits intoalloy-rs:mainfrom
noble-assets:feat/20260317-ws-fallback
Open

feat(pubsub): add FallbackPubSubConnect for multi-endpoint reconnection#3833
smuu wants to merge 2 commits intoalloy-rs:mainfrom
noble-assets:feat/20260317-ws-fallback

Conversation

@smuu
Copy link
Copy Markdown

@smuu smuu commented Mar 24, 2026

Closes #3816

Motivation

A single WS endpoint failure kills PubSub subscriptions with no automatic recovery to a different endpoint. For use cases like block-following nodes that rely on a continuous subscription stream, this means downtime until manual intervention.

Solution

Adds FallbackPubSubConnect<T: PubSubConnect> — a wrapper that holds multiple connectors and round-robins across them on reconnection. connect() always uses the first connector (primary); try_reconnect() cycles through all connectors via atomic counter.

Tested in production: when the primary WS endpoint was killed, PubSubService detected the failure via missed pong, called try_reconnect, failed over to the second endpoint, and resumed the block subscription automatically.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Feature] Multi-endpoint fallback for PubSub connections

1 participant