Request Format
Solana RPC WebSocket methods use JSON-RPC 2.0 over a persistent WebSocket connection. Connect to the PubSub endpoint atws://<ADDRESS>/ or
wss://<ADDRESS>/.
| Field | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC version. Set this to "2.0". |
id | string | number | null | Client-supplied request identifier. The server echoes it in the subscribe response. |
method | string | PubSub method name, such as accountSubscribe or slotSubscribe. |
params | array | Ordered method parameters. Use an empty array when the method takes no parameters. |
commitment parameter. If
unspecified, subscriptions that accept commitment default to finalized.
Notification Format
After a subscribe request succeeds, the server returns a numeric subscription id in the JSON-RPC response. Later notifications are pushed as JSON-RPC messages with a method-specific notification name and the active subscription id.| Field | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC version. |
method | string | Notification name, such as accountNotification or slotNotification. |
params.result | any | Method-specific notification payload. Many methods include a context object and a method-specific value. |
params.subscription | number | Subscription id returned by the corresponding *Subscribe method. |
context and value, PubSub includes
context.slot and omits context.apiVersion.
Method Reference
Accounts
| Method | Description |
|---|---|
accountSubscribe | Subscribe to notifications when one account’s lamports or data change. |
accountUnsubscribe | Cancel an accountSubscribe subscription. |
programSubscribe | Subscribe to notifications for accounts owned by a program. |
programUnsubscribe | Cancel a programSubscribe subscription. |
Transactions
| Method | Description |
|---|---|
logsSubscribe | Subscribe to transaction log messages that match a log filter. |
logsUnsubscribe | Cancel a logsSubscribe subscription. |
signatureSubscribe | Subscribe to status notifications for one transaction signature. |
signatureUnsubscribe | Cancel a signatureSubscribe subscription. |
Blocks
| Method | Description |
|---|---|
blockSubscribe | Subscribe to block notifications as blocks reach confirmed or finalized commitment. |
blockUnsubscribe | Cancel a blockSubscribe subscription. |
Cluster
| Method | Description |
|---|---|
rootSubscribe | Subscribe to notifications when the validator sets a new root slot. |
rootUnsubscribe | Cancel a rootSubscribe subscription. |
slotSubscribe | Subscribe to notifications when the validator processes a new slot. |
slotUnsubscribe | Cancel a slotSubscribe subscription. |
slotsUpdatesSubscribe | Subscribe to tagged slot lifecycle updates emitted by the validator. |
slotsUpdatesUnsubscribe | Cancel a slotsUpdatesSubscribe subscription. |
voteSubscribe | Subscribe to gossip vote notifications. |
voteUnsubscribe | Cancel a voteSubscribe subscription. |