Yellowstone WebSockets Reference
YellowSocket Methods
YellowSockets
We allow all Yellowstone methods over WebSockets. Yellowstone gRPC has lower overhead than WebSockets, but YellowSockets is useful when:
- You require Yellowstone data in a frontend.
- You want to rapidly prototype an idea.
- You are new to Solana and want to start using data streams.
Native WebSocket support
YellowSockets Endpoints
wss://yellowstone.eu.fluxrpc.com wss://yellowstone.us.fluxrpc.com
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 ItHow 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.
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()
}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.