Expand description
Realtime module for Supabase WebSocket subscriptions
This module provides cross-platform WebSocket support using proper abstractions:
- Native: Uses tokio-tungstenite with TLS support
- WASM: Uses web-sys WebSocket API through the browser
§Usage
use supabase::Client;
use supabase::realtime::RealtimeEvent;
let client = Client::new("your-url", "your-key")?;
let realtime = client.realtime();
// Connect to realtime
realtime.connect().await?;
// Subscribe to table changes
let subscription_id = realtime
.channel("posts")
.table("posts")
.event(RealtimeEvent::All)
.subscribe(|message| {
println!("Received update: {:?}", message);
})
.await?;
// Later, unsubscribe
realtime.unsubscribe(&subscription_id).await?;
Structs§
- Channel
Builder - Builder for channel subscriptions
- Realtime
- Realtime client for WebSocket subscriptions
- Realtime
Message - Realtime message received from Supabase
- Realtime
Payload - Payload of a realtime message
- Subscription
- Subscription information
- Subscription
Config - Configuration for subscriptions
Enums§
- Realtime
Event - Realtime event types for filtering subscriptions