LiveClient::resubscribe
Resubscribes only to active subscriptions, removing the original start time, if any.
Stored subscriptions and unsubscriptions are replayed in the order they were sent.
Usually performed after calling Live.reconnect.
API method
async fn resubscribe(&mut self) -> crate::Result<()>; Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use databento::{
LiveClient,
dbn::{Dataset::IfeuImpact, SType, Schema},
live::Subscription,
};
// Create a live client
let mut client = LiveClient::builder()
.key("$YOUR_API_KEY")?
.dataset(IfeuImpact)
.build()
.await?;
// Subscribe to the 1-minute bars for all BRN futures
client
.subscribe(
Subscription::builder()
.schema(Schema::Ohlcv1M)
.stype_in(SType::Parent)
.symbols("BRN.FUT")
.build(),
)
.await?;
// Reconnect and resend the previous subscription
client.reconnect().await?;
client.resubscribe().await?;