Yellowstone WebSockets Reference

YellowSocket Methods

YellowSocket methods work exactly like their Yellowstone equivalents. The subscription structure is the same. The only difference is that they work over WebSockets instead of gRPC.

YellowSockets

We allow all Yellowstone methods over WebSockets. Yellowstone gRPC has lower overhead than WebSockets, but YellowSockets is useful when:

  1. You require Yellowstone data in a frontend.
  2. You want to rapidly prototype an idea.
  3. You are new to Solana and want to start using data streams.

Native WebSocket support

YellowSockets does not proxy your requests. The FluxRPC Yellowstone service natively supports both gRPC and WebSockets to minimize latency.

YellowSockets Endpoints

Solana
text
wss://yellowstone.eu.fluxrpc.com
wss://yellowstone.us.fluxrpc.com
Fogo
text
wss://yellowstone.eu.fogo.fluxrpc.com
wss://yellowstone.nyc.fogo.testnet.fluxrpc.com

Try It — Live Subscription

Use the existing Yellowstone Try It page to subscribe to real-time events directly from your browser.

Open Try It

How Subscriptions Work

Open a WebSocket connection and send a Yellowstone SubscribeRequest. The same connection receives SubscribeUpdate messages. Close the socket to stop the stream.

YellowSocket methods work exactly like their Yellowstone equivalents. The subscription structure is the same. The only difference is that they work over WebSockets instead of gRPC.

Account subscription example

For an account subscription, you can specify the public key, owner, and filters just like in Yellowstone. The equivalent YellowSockets request follows.

Yellowstone gRPC
Rust
SubscribeRequest {
  accounts: HashMap::from([(
    "account_updates".to_string(),
    SubscribeRequestFilterAccounts {
      account: vec!["<PUBLIC_KEY>".to_string()],
      owner: vec!["<OWNER_PROGRAM>".to_string()],
      filters: vec![
        SubscribeRequestFilterAccountsFilter {
          filter: Some(Filter::TokenAccountState(true)),
        },
      ],
      ..Default::default()
    },
  )]),
  commitment: Some(CommitmentLevel::Confirmed as i32),
  ..Default::default()
}
YellowSockets
JavaScript
const subscription = {
  accounts: {
    account_updates: {
      account: ["<PUBLIC_KEY>"],
      owner: ["<OWNER_PROGRAM>"],
      filters: [{ tokenAccountState: true }],
    },
  },
  commitment: "CONFIRMED",
};

const socket = new WebSocket(
  "wss://yellowstone.eu.fluxrpc.com?key=<API_KEY>&encoding=json",
);

socket.addEventListener("open", () => {
  socket.send(JSON.stringify(subscription));
});

socket.addEventListener("message", (event) => {
  console.log(JSON.parse(event.data));
});

The values inside accounts are the same Yellowstone account filter fields. See Account subscriptions for the complete filter reference.