Solana RPC · WebSocket subscriptions
WS programSubscribe
Stream account changes owned by a program.
Endpoint
WebSocket wss://solrpc.infinityblocks.io/<API_KEY>
Open the socket, then send a JSON-RPC programSubscribe message. The server replies with a subscription id, then pushes notifications until you unsubscribe.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
programId | string | yes | Base-58 program id. |
config | object | no | encoding, commitment, filters (memcmp/dataSize). |
Subscribe message
{"jsonrpc":"2.0","id":1,"method":"programSubscribe","params":["<PROGRAM_ID>",{"encoding":"base64","commitment":"confirmed","filters":[{"dataSize":165}]}]}
With @solana/web3.js
rpc.onProgramAccountChange(new PublicKey("<PROGRAM_ID>"), (info) => console.log(info.accountId.toBase58()), "confirmed", [{ dataSize: 165 }]);
Reply
{ "jsonrpc": "2.0", "id": 1, "result": 0 // subscription id }
Notification
{ "jsonrpc": "2.0", "method": "programNotification",
"params": { "subscription": 0,
"result": { "context": { "slot": 423214981 },
"value": { "pubkey": "<ACCOUNT>", "account": { "lamports": 12480000, "owner": "<PROGRAM_ID>", "data": ["","base64"], "executable": false } } } } }
High-volume programs emit many notifications — always use filters (memcmp/dataSize) to scope the stream.
Try it
The interactive runner covers HTTP methods. WebSocket subscriptions use a persistent socket — use the subscribe message and the
@solana/web3.js example above.