What Does eth_subscribe Stream Over Ethereum WebSocket RPC?
What is eth_subscribe in Ethereum WebSocket RPC? It opens a persistent connection that pushes live chain events, while leaving reconnection and missed-event recovery to you.
The Finality Desk5 min read#3471c6

What is eth_subscribe in Ethereum JSON-RPC? It is a method that opens a live event stream over WebSocket, pushing new heads, matching logs or pending transactions as they occur. It replaces repeated polling with server push, but the client must restore the stream and recover missed events after a disconnect.
eth_subscribe pushes matching events over WebSocket
eth_subscribe sends a subscription request to an Ethereum node over a persistent WebSocket connection. The node returns a subscription ID, then sends matching updates as JSON-RPC notifications named eth_subscription. Each notification carries that ID, so the client can associate the event with the right subscription. The stream ends when the client calls eth_unsubscribe or the connection drops.
The endpoint must use wss:// for a secure WebSocket connection; an HTTPS RPC endpoint is a different transport. Chainlist adds useful background by describing EVM networks and their RPC endpoints, including WebSocket endpoints separately from HTTPS ones.
Geth documents three common subscription types. newHeads reports new block headers, logs reports matching log entries, and newPendingTransactions reports pending transaction hashes. A subscription is a live feed, not a request for the node to return a historical range of events.
The message flow has three stages. First, the client sends eth_subscribe with a type and, where relevant, a filter. Next, the node responds with a subscription ID. Then the node pushes eth_subscription notifications until the client unsubscribes or loses the socket. The client should keep the ID for the active connection and use it to end that subscription with eth_unsubscribe.
A token log subscription filters by address and topic
A logs subscription can filter for events from one token contract and for its Transfer event. The request supplies the contract address and a topics filter containing the Transfer event signature. Each matching log arrives as a pushed eth_subscription message, with the contract address, topics and event data. The filter narrows which logs the node sends; it does not change what the token contract emits.
Illustrative before and after: before the subscription, an application asks for logs repeatedly with separate polling requests and sees new matches only when it polls. After it opens the WebSocket subscription, the same token and Transfer filter stay in place while the node pushes each match. The event data is the same kind of log; what changes is how the application receives it.
That stream is useful for live token activity, dashboards and services reacting to contract events. It does not guarantee that every event reaches the application. A socket can close, and subscriptions end with it. The node does not replay notifications missed while the client was disconnected.
Reconnects require resubscribing and backfilling
After a disconnect, the client must open a new WebSocket, create the subscription again and use eth_getLogs to retrieve the gap. Store the last fully processed block number as the stream runs. Once reconnected, query eth_getLogs with the same address and topic filter from the next block after that saved number through a recent block, then resume processing live notifications.
The order matters: establish the new subscription, backfill the gap, and reconcile any overlap between historical results and live notifications. Keep processing safe to repeat, since recovery can return a log the application has already handled. Advance the saved block only after the application has finished processing the relevant events for it. That record gives the next recovery a reliable starting point.
For log subscriptions, a notification can include a removed flag. When it is true, the log was removed from the current chain view, typically during a reorganization; it should not remain treated as a canonical event. Update any state derived from it, then process the replacement chain’s logs. A live feed reports changes as the node sees them, so applications that need a consistent history must account for these reversals.
Related questions
eth_subscribe vs eth_newFilter polling
eth_subscribe pushes matching updates over WebSocket as they occur. eth_newFilter creates a filter that the client checks by polling, commonly with eth_getFilterChanges. The first reduces repeated requests for live updates; the second makes the client responsible for checking. Neither removes the need to recover a gap with historical log queries after a connection or polling interruption.
What does the removed flag mean in log notifications?
The removed flag marks a log that was previously reported but no longer belongs to the node’s current chain view. Treat it as a correction: reverse any derived action based on that log and apply logs from the replacement chain. Persisting the processed block and reconciling after reconnect helps keep the application’s event history aligned with the chain.
Follow-up questions
How many subscriptions can one WebSocket connection hold?
There is no single subscription count to rely on across Ethereum nodes and RPC providers. Capacity depends on the client and service limits, as well as the resources used by the filters and notification volume. Check the limits of the endpoint you operate or use, and monitor connection errors and lag.
Can a dapp use eth_subscribe through a browser wallet?
Only when the wallet’s provider exposes the method and supports the required WebSocket subscription transport. A dapp should not assume that an injected browser wallet provider supports eth_subscribe; its available methods depend on the wallet. A dapp can instead connect to a WebSocket RPC endpoint directly, while handling that connection and its recovery itself.
eth_subscribe gives developers low-latency updates by keeping a WebSocket stream open. Because notifications are not replayed after disconnection, reliable consumers must save progress, resubscribe and backfill with eth_getLogs.