Parameters
None. This method does not accept any parameters.Response
-
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 finalized
-
slotSubscribe
code examples
This example subscribes to slot updates.
Note that subscriptions require a WebSocket connection and WebSocket cat for you to use this method in the console.Install WebSocket cat with:
npm install -g wscat
Use case
TheslotSubscribe
method is essential for applications that need to monitor the progress of the Solana blockchain. Common use cases include:
- Block height tracking: Monitor the current slot height of the blockchain
- Chain progress monitoring: Track the advancement of processed, confirmed, and finalized slots
- Timing operations: Coordinate operations based on slot progression
- UI updates: Update user interfaces with current blockchain progress
- Performance monitoring: Track slot processing times and chain progress rates