[Feature] Multi-endpoint fallback for PubSub connections
- Langage dominant
- Rust
- Étoiles
- 1.3k
- Forks
- 668
- Merge moyen
- 2 j 2 h
- PR mergées (30 j)
- 29
Description
### Component
provider, pubsub
### Describe the feature you would like
`FallbackService` handles request/response failover across multiple HTTP transports, but there's no equivalent for PubSub connections. When a WS connection drops, `PubSubService` retries the same endpoint — if that endpoint is permanently down, subscriptions are lost.
I ran into this in [paradigmxyz/reth#22648](https://github.com/paradigmxyz/reth/pull/22648) where I needed WS failover for reth's debug consensus client. The reviewer suggested using Alloy's fallback layer, but `FallbackService` operates on `RequestPacket`/`ResponsePacket` — it has no concept of stateful subscriptions.
Would a `PubSubConnect` wrapper that cycles through multiple endpoints on reconnection be welcome? The existing `try_reconnect()` override point in `PubSubService`'s retry loop seems like a natural fit, requiring minimal changes to existing code.
Happy to put up a PR if this approach sounds reasonable.
### Additional context
_No response_
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.