Skip to main content

Module subscription_manager

Module subscription_manager 

Source
Expand description

Actor-based subscription manager for WebSocket eth_subscribe connections.

The SubscriptionManager is a GenServer actor that owns all subscription state. It receives NewHead messages from block producers / fork choice handlers and fans out notifications to all connected WebSocket clients through per-connection mpsc channels.

Using an actor removes the need for a broadcast channel and eliminates the “lagged subscriber” problem: when a connection drops, its sender is removed during the next new_head fan-out rather than silently accumulating unread messages.

Modules§

subscription_manager_protocol

Structs§

SubscriptionManager
Actor that manages all active WebSocket subscriptions.

Constants§

MAX_SUBSCRIPTIONS_PER_CONNECTION
Maximum number of active subscriptions allowed per WebSocket connection.
MAX_TOTAL_SUBSCRIPTIONS
Maximum number of active subscriptions across all connections.
SUBSCRIBER_CHANNEL_CAPACITY
Maximum number of buffered notifications per subscriber. If a subscriber’s channel is full (slow WebSocket client), the notification is dropped rather than blocking the actor. Matches Geth’s approach of dropping slow clients (Geth uses 20,000; we use a smaller buffer since each notification is already serialized JSON).

Traits§

SubscriptionManagerProtocol
Messages understood by the SubscriptionManager.
ToSubscriptionManagerRef

Type Aliases§

SubscriptionManagerRef
Type-erased reference to any actor implementing SubscriptionManagerProtocol.