The slotSubscribe
method in Solana allows developers to receive real-time notifications about slot updates. This subscription-based method provides updates whenever a new slot is processed by the node.
result
- An integer subscription id (needed to unsubscribe)
subscription
- An object containing slot information:
slot
- The current slot height
parent
- The parent slot height
root
- The current root slot height
status
- The processing status of the slot:
"processed"
- Slot has been processed"confirmed"
- Slot has been confirmed"finalized"
- Slot has been finalizedslotSubscribe
code examplesnpm install -g wscat
$ wscat -c YOUR_CHAINSTACK_WEBSOCKET_ENDPOINT
# Wait for the connection to be established
Connected (press CTRL+C to quit)
> {"jsonrpc":"2.0","id":1,"method":"slotSubscribe"}
slotSubscribe
method is essential for applications that need to monitor the progress of the Solana blockchain. Common use cases include:
Was this page helpful?