slotSubscribe
Subscribes to slot progression and streams a notification each time the node processes a new slot.
slotSubscribe is the cluster's heartbeat: it takes no parameters and pushes
a slotNotification every time the serving node processes a new slot —
roughly every 400 ms on a healthy cluster. Each notification carries three
numbers: slot (the slot just processed), parent (the slot it builds on),
and root (the newest rooted slot the node knows, i.e. the finalized
watermark trailing a few dozen slots behind the tip).
It replaces polling getSlot in any latency-sensitive loop. Common uses:
driving a "current slot" ticker in an explorer or dashboard; timestamping
events from other subscriptions on the same socket; measuring your own
pipeline lag by comparing the streamed tip against the slots your data
arrives at; building blockhash-expiry countdowns for pending transactions;
and acting as an application-level liveness signal — if slot notifications
stall for more than a couple of seconds, the node or your connection is in
trouble, which makes this the cheapest health probe a WebSocket session can
carry.
Interpret the stream carefully. Slots arrive at the node's processed level,
so the sequence tracks the tip of the fork the node is currently on — it is
not a finality signal. The slot sequence is not guaranteed to be strictly
consecutive from the client's point of view: skipped slots (leaders that
produced no block) and minor fork switches mean you may observe gaps, and
parent is how you stitch the true chain together. If you need to know when
slots become final rather than merely processed, subscribe to
rootSubscribe instead, or watch the root field
here. For fine-grained per-slot lifecycle events (shreds received, banks
frozen, dead slots), the heavier slotsUpdatesSubscribe
exists. As with all Pub/Sub streams, a reconnect requires a fresh
slotSubscribe; stop the stream with slotUnsubscribe.
Parameters
None — params is an empty array (or omitted).
Response
Subscribe ack:
Roughly every 400 ms thereafter:
{
"jsonrpc": "2.0",
"method": "slotNotification",
"params": {
"subscription": 3114,
"result": {
"parent": 348392040,
"root": 348392008,
"slot": 348392041
}
}
}result (on ack)integerslotUnsubscribe.params.result.slotintegerparams.result.parentintegerslot.params.result.rootintegerErrors
| Code | Meaning | When it happens |
|---|---|---|
4003 | forbidden | Your tier is below basic (tier_insufficient). |
4001 | unauthorized | Missing or invalid API key on the upgrade / auth frame. |
4029 | rate_limited | Subscribe rate exceeded for your tier. |
Notes
- Processed, not final: the stream follows the node's current fork tip;
use
root(orrootSubscribe) for finality. - Gaps are normal: skipped slots and fork switches make the sequence
non-consecutive; chain by
parentwhen ordering matters. - ~2.5 frames/sec, forever: cheap individually, but unsubscribe when the consumer goes away.
- Related methods:
slotUnsubscribe,rootSubscribe,slotsUpdatesSubscribe, andgetSlotfor one-shot reads.