radion-sdk is the Rust SDK (you import it as radion_sdk). It is async-first, built on tokio, and has few dependencies. Events come as typed Streams, not callbacks. You match on the payload enum, so the compiler checks you handle every case. Needs Rust 1.85+.
Usage
use futures_util::StreamExt;
use radion_sdk::realtime::{Channel, Payload, Subscription};
use radion_sdk::Radion;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let radion = Radion::builder()
.api_key(std::env::var("RADION_API_KEY")?)
.build()?;
radion.realtime.connect().await?;
let mut trading = radion
.realtime
.subscribe(Subscription::new("trading", Channel::Trading))
.await?;
while let Some(event) = trading.next().await {
if let Payload::Trading(trade) = event.data {
println!("{} {:?}", event.id, trade.kind);
}
}
Ok(())
}
Features
The crate uses cargo features, so you build only the parts you use:
| Feature | Default | Description |
|---|
realtime | ✅ | The WebSocket features. |
rustls | ✅ | rustls TLS backend (no system OpenSSL dependency). |
native-tls | | Use the platform native TLS backend instead. |
tracing | | Emit tracing events. |
# realtime + native TLS + tracing, without the default rustls backend
cargo add radion-sdk --no-default-features --features realtime,native-tls,tracing
Standalone realtime client
If you only need the stream, build RealtimeClient on its own. This is also where you tune reconnect and heartbeat:
use radion_sdk::realtime::{RealtimeClient, RealtimeOptions};
let client = RealtimeClient::new(RealtimeOptions::new("sk_..."));
client.connect().await?;
Exports
| Export | Kind |
|---|
Radion, RadionBuilder | client |
realtime::RealtimeClient, RealtimeOptions | realtime |
RadionError | errors |
realtime::{Subscription, ChannelFilters, ChannelEvent, Payload} | types |
realtime::{Channel, SubscribableChannel, CHANNELS} | channels |
realtime::{LifecycleEvent, ReconnectOptions, HeartbeatOptions} | options |
Each channel event’s data is the typed Payload enum (Payload::Trading, Payload::Oracle, …). The SDK keeps unknown channels or event types as Payload::Other(serde_json::Value), so a new server event is never lost.Last modified on July 5, 2026