Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebSocket

Subscribe to accounts, programs, logs, signatures, slots, blocks, and transactions over wss:// with the Solana WebSocket API, backed by Dragon's Mouth gRPC.

Connect at wss://<your-endpoint>.mainnet.rpcpool.com/<your-token>.

The WebSocket service runs on Whirligig, Triton's WebSocket server for Dragon's Mouth gRPC. Usage pages and invoices list WebSocket traffic as Whirligig. The older /whirligig path reaches the same service.

Use cases

  • Real-time browser apps and browser extensions. Browsers don't support gRPC. Subscribe over wss:// with the standard Solana WebSocket API.

  • Backends. If you can run a gRPC client, use Dragon's Mouth. If your backend already uses a Solana WebSocket client, use the WebSocket API.

Features

transactionSubscribe

A full-transaction subscription, a Triton extension, with account include, exclude, and required filters.

Intra-slot updates

At processed commitment, accountSubscribe and programSubscribe notify on every account write as the stream delivers it, within the slot.

jsonParsed encoding

accountSubscribe and programSubscribe return structured objects for parsable programs instead of raw byte arrays, with resolved mint metadata on token accounts.

blockSubscribe

New blocks over wss://. Needs confirmed or finalized commitment.

How it works

The WebSocket server reads a Dragon's Mouth gRPC stream, matches the updates to each client's subscriptions, and sends them as standard Solana WebSocket notifications.

Supported methods

The methods follow the Solana WebSocket API. Parameters and results are in WebSocket methods, except for rootSubscribe, voteSubscribe, and slotsUpdatesSubscribe, which have no reference page.

Method
Returns

accountSubscribe

An account's data, on change

blockSubscribe

New blocks

logsSubscribe

Transaction logs mentioning an address

programSubscribe

Accounts owned by a program, on change

signatureSubscribe

A signature's confirmation status

slotSubscribe

Each new slot

rootSubscribe

Each new root (the highest finalized slot)

voteSubscribe

Votes from committed vote transactions (none on Alpenglow; unstable Solana method)

slotsUpdatesSubscribe

Detailed slot-status updates (unstable Solana method)

transactionSubscribe

Full transactions matching a filter. Triton extension to the Solana WebSocket API

Each subscribe method returns a subscription id and has a matching unsubscribe (see Unsubscribe).

Connection options

Set wsEndpoint to your wss:// endpoint URL. Standard Solana WebSocket clients usually need no other change.

Uses the standard solana-pubsub-client crate.

Required for transactionSubscribe, which returns full transaction data in a single call and is not available in @solana/web3.js.

Connections idle for over 60 seconds are closed, so keep them alive by sending {"jsonrpc":"2.0","method":"ping"}.

Run your client close to a Triton region to lower latency.

Commitment levels

Set the commitment level per subscription in the config argument. blockSubscribe accepts confirmed or finalized, not processed.

Level
Meaning
Update sent

processed

The node has processed the transaction or account write; its slot can still be in progress. Not yet confirmed or finalized; the block can still be skipped by the cluster.

Without waiting for its slot to finish

confirmed

The highest slot voted on by a supermajority of the cluster. On Alpenglow, confirmed and finalized updates arrive together.

After its slot reaches confirmed

finalized

The highest slot that is final. On Alpenglow, a block becomes final about 150 ms after the leader proposes it.

After its slot reaches finalized

The WebSocket server subscribes to Dragon's Mouth at processed.

For the lowest latency, subscribe at processed and track confirmed and finalized yourself. slotsUpdatesSubscribe sends optimisticConfirmation when a slot is confirmed and root when it is finalized.

Subscribe request

accountSubscribe

blockSubscribe

logsSubscribe

programSubscribe

signatureSubscribe

slotSubscribe

transactionSubscribe

A Triton extension to the Solana WebSocket API. One subscription returns the full transaction, including metadata, log messages, token balances, and compute units, replacing a signatureSubscribe + getTransaction loop. Takes a filter object (all fields optional) and an optional config with the same fields as RpcBlockSubscribeConfig, except transactionDetails: "none", which is refused.

Unsubscribe

Every subscribe request returns the subscription id on success:

Pass that id to the matching unsubscribe method (accountUnsubscribe, slotUnsubscribe, and so on):

The result is true if the subscription was active and removed:

An id that does not exist on the connection returns error -32602, Invalid subscription id.

Client

You can find a reference CLI client on GitHub: WebSocket CLI client.

Pricing

WebSocket traffic is billed by the bandwidth it streams, on shared and dedicated endpoints. By default, a dedicated endpoint's WebSocket connections are served by Triton's shared servers, not by your node. See the pricing page.

WebSocket frames are not compressed (no permessage-deflate).

To stream less:

  • Filter your subscriptions: filters on programSubscribe, account filters on transactionSubscribe.

  • Use the base64+zstd encoding when bandwidth is limited, not by default. It compresses the account data field, not the whole message, and costs CPU on the server and on your client.

What's next


Contact support by clicking the chat icon in your customer dashboard Sales questions? Contact us AI agent? Read llms.txt Follow updates: Blog · X · YouTube · Telegram · GitHub

Last updated