[Supanode](https://supanode.xyz/)[Learn](https://supanode.xyz/learn)Recover a silent blockchain WebSocket subscription

# Recover a silent blockchain WebSocket subscription

Treat reconnecting, resubscribing and repairing missed events as separate steps.

**On this page**[A new socket starts a new session](https://supanode.xyz/learn/websocket-subscription-reconnect#a-new-socket-starts-a-new-session)[Persist the desired subscriptions](https://supanode.xyz/learn/websocket-subscription-reconnect#persist-the-desired-subscriptions)[Repair the disconnect window](https://supanode.xyz/learn/websocket-subscription-reconnect#repair-the-disconnect-window)[Test failure before launch](https://supanode.xyz/learn/websocket-subscription-reconnect#test-failure-before-launch)[Sources](https://supanode.xyz/learn/websocket-subscription-reconnect#sources)

## A new socket starts a new session

A subscription identifier belongs to the connection that created it. Reopening a WebSocket does not restore subscriptions from the old connection. A healthy transport can also carry no relevant events, so separate connection liveness from business-data freshness in your monitoring.

## Persist the desired subscriptions

```
on_disconnect: mark_stream_stale(); reconnect_with_backoff()
on_connect: subscribe_all(desired_filters)
on_subscription_ack: record_new_session_id()
on_event: persist_then_advance_checkpoint(event)
```

This is lifecycle pseudocode, not a network-specific API. Solana, EVM and Hyperliquid use different subscription messages. Store desired filters independently from server-assigned identifiers.

## Repair the disconnect window

1.  Record the last durably processed block, slot or stable event identity.
2.  Reconnect with jitter and create fresh subscriptions. Buffer live messages while recovering history if your design requires a continuous timeline.
3.  Fetch the gap through a supported historical API or replay mechanism. An ordinary subscription does not imply replay.
4.  Deduplicate the overlap using the network's event identity and reconcile reorganized or unfinalized records.

## Test failure before launch

Deliberately disconnect a trial stream for a short, measured interval. Verify that your recovery reaches the same checkpoint as a reference collector. Alert on queue depth, parsing failures and time since the last expected event as well as ping failures. If the recovery window exceeds available replay, mark the gap and use a suitable historical source instead of silently continuing with an incomplete dataset.

## Sources

-   [Geth subscription lifecycle](https://geth.ethereum.org/docs/interacting-with-geth/rpc/pubsub)
-   [Solana WebSocket methods](https://solana.com/docs/rpc/websocket)
-   [Hyperliquid subscriptions](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions)

## Continue reading

[Choose a stream transport](https://supanode.xyz/learn/choose-blockchain-stream-transport)[Learn library](https://supanode.xyz/learn)

---
Source: https://supanode.xyz/learn/websocket-subscription-reconnect
