Skip to main content

logsSubscribe RPC Method

Loading...

Updated on
May 01, 2026

logsSubscribe RPC Method

As of May 1, 2026, this WebSocket method is billed based on metered data usage: 0.1 MB = 15 API credits. Learn more about WebSocket billing.

Parameters

filters
string
Loading...
all
string
Loading...
allWithVotes
string
Loading...
object
object
Loading...
mentions
array
Loading...
encoding
Loading...
object
array
Loading...
commitment
string
Loading...
finalized
string
Loading...
confirmed
string
Loading...
processed
string
Loading...

Returns

result
integer
Loading...
Notification Format:
object
Loading...
signature
string
Loading...
err
object
Loading...
logs
array
Loading...
Request
1
import { createSolanaRpcSubscriptions, address } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const publicKeyString = address('E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk');
7
const abortController = new AbortController();
8
9
const subscription = await rpcSubscriptions
10
.logsNotifications({ mentions: [publicKeyString] })
11
.subscribe(
12
{ abortSignal: abortController.signal }
13
);
14
15
try {
16
for await (const notification of subscription) {
17
console.log("Updated account info: ", notification);
18
}
19
} catch (e) {
20
console.error("Error in logs subscription:", e);
21
} finally {
22
abortController.abort();
23
console.log('Unsubscribed from logs');
24
}
25
}
26
27
main();
1
import { createSolanaRpcSubscriptions, address } from '@solana/kit';
2
3
const rpcSubscriptions = createSolanaRpcSubscriptions('');
4
5
async function main() {
6
const publicKeyString = address('E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk');
7
const abortController = new AbortController();
8
9
const subscription = await rpcSubscriptions
10
.logsNotifications({ mentions: [publicKeyString] })
11
.subscribe(
12
{ abortSignal: abortController.signal }
13
);
14
15
try {
16
for await (const notification of subscription) {
17
console.log("Updated account info: ", notification);
18
}
19
} catch (e) {
20
console.error("Error in logs subscription:", e);
21
} finally {
22
abortController.abort();
23
console.log('Unsubscribed from logs');
24
}
25
}
26
27
main();
Response
1
{
2
"jsonrpc": "2.0",
3
"result": 24040,
4
"id": 1
5
}
1
{
2
"jsonrpc": "2.0",
3
"result": 24040,
4
"id": 1
5
}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free