Skip to main content

slotSubscribe RPC Method

Loading...

Updated on
Apr 30, 2025

slotSubscribe RPC Method

Parameters

This method does not accept any parameters

Returns

result
Loading...
Notification Format:
Loading...
parent
Loading...
root
Loading...
slot
Loading...
Request
1
import { createSolanaRpcSubscriptions } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const abortController = new AbortController();
7
8
const subscription = await rpcSubscriptions
9
.slotNotifications()
10
.subscribe({ abortSignal: abortController.signal });
11
12
try {
13
for await (const notification of subscription) {
14
console.log("Updated slot info: ", notification);
15
}
16
} catch (e) {
17
console.error(e);
18
} finally {
19
abortController.abort();
20
console.log('Unsubscribed from slot changes');
21
}
22
}
23
24
main();
Response
1
{
2
"jsonrpc": "2.0",
3
"result": 0,
4
"id": 1
5
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free