Skip to main content

programSubscribe RPC Method

Loading...

Updated on
May 01, 2026

programSubscribe 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

program_id
string
Loading...
object
object
Loading...
commitment
string
Loading...
finalized
Loading...
confirmed
Loading...
processed
Loading...
encoding
string
Loading...
filters
string
Loading...

Returns

result
integer
Loading...
Notification Format:
Loading...
Request
1
const web3 = require("@solana/web3.js");
2
(async () => {
3
const publicKey = new web3.PublicKey(
4
"22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD"
5
);
6
const solanaConnection = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/", {
7
wsEndpoint: "",
8
});
9
solanaConnection.onProgramAccountChange(
10
publicKey,
11
(updatedProgramInfo, context) =>
12
console.log("Updated program info: ", updatedProgramInfo),
13
"confirmed"
14
);
15
})();
16
1
const web3 = require("@solana/web3.js");
2
(async () => {
3
const publicKey = new web3.PublicKey(
4
"22Y43yTVxuUkoRKdm9thyRhQ3SdgQS7c7kB6UNCiaczD"
5
);
6
const solanaConnection = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/", {
7
wsEndpoint: "",
8
});
9
solanaConnection.onProgramAccountChange(
10
publicKey,
11
(updatedProgramInfo, context) =>
12
console.log("Updated program info: ", updatedProgramInfo),
13
"confirmed"
14
);
15
})();
16
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