Skip to main content
Solami supports two streaming protocols: gRPC for high-throughput production workloads, and WebSocket for lightweight subscriptions. Both deliver real-time data — the right choice depends on your volume and filtering needs.

Compare protocols

FeaturegRPCWebSocket
ProtocolYellowstone gRPCJSON-RPC over WebSocket
Min planPro ($99/mo)Dev ($49/mo)
ThroughputHighModerate
FilteringAdvanced (account, program, tx type)Basic
Best forProduction streaming, HFT, block processingSimple subscriptions, balance monitoring

gRPC

gRPC streams are built on the Yellowstone protocol and give you fine-grained, low-latency access to transactions, accounts, and blocks. Use gRPC when you need high volume or need to filter across multiple accounts and programs simultaneously. Endpoint: https://grpc.solami.fast?api_key=YOUR_API_KEY Minimum plan: Pro ($99/mo) — see pricing

When to use gRPC

  • Streaming all transactions for a specific program
  • Monitoring multiple accounts simultaneously
  • High-frequency trading data pipelines
  • Block-level data processing

Example: subscribe to transactions

This example uses the Solami Rust SDK to subscribe to confirmed transactions for a given account:
#![allow(deprecated)]
use futures_util::StreamExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let _ = dotenvy::dotenv();

    // Reads SOLAMI_API_KEY from the environment
    let mut client = solami::from_env().build().await?;

    let accounts = vec![
        "11111111111111111111111111111111".to_string(),
    ];

    let (_sink, mut stream) = client
        .grpc()
        .subscribe_transactions(
            "tx_sub",
            accounts,
            solami::CommitmentLevel::Confirmed,
        )
        .await?;

    println!("Subscribed to transactions via gRPC...");

    while let Some(Ok(msg)) = stream.next().await {
        if let Some(solami::GrpcUpdateKind::Transaction(tx)) = msg.update_oneof {
            if let Some(info) = tx.transaction {
                println!("Signature: {:?} | Slot: {}", info.signature, tx.slot);
            }
        }
    }

    Ok(())
}
Set SOLAMI_API_KEY in your environment before running. solami::from_env() reads it automatically.
For full details on the gRPC API, see the gRPC infrastructure page.

WebSocket

WebSocket uses the standard Solana JSON-RPC subscription interface, making it a drop-in for any tooling that already speaks it. Use WebSocket when you have a small number of subscriptions and don’t need advanced filtering. Endpoint: wss://rpc.solami.fast/ws/sol?api_key=YOUR_API_KEY Minimum plan: Dev ($49/mo) — see pricing

When to use WebSocket

  • Monitoring a single account balance
  • Watching for transaction confirmations
  • Receiving slot or root notifications
  • Lighter workloads with fewer than a handful of subscriptions

Example: subscribe to account changes

const ws = new WebSocket(
  "wss://rpc.solami.fast/ws/sol?api_key=YOUR_API_KEY"
);

ws.onopen = () => {
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "accountSubscribe",
    params: [
      "ACCOUNT_ADDRESS",
      { encoding: "jsonParsed", commitment: "confirmed" }
    ],
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.method === "accountNotification") {
    console.log("Account changed:", data.params.result);
  }
};
Replace ACCOUNT_ADDRESS with the base-58 public key of the account you want to watch. For full details on available subscription methods, see the WebSocket infrastructure page.