pub struct TypedSubscription<T> { /* private fields */ }Expand description
Handle for a typed protobuf realtime subscription.
After a transport reconnect the subscription is re-established without a
server-side resume cursor. Self::resubscribes / Self::take_resubscribed
signal that gap: publications may have been lost.
Implementations§
Source§impl<T> TypedSubscription<T>
impl<T> TypedSubscription<T>
pub async fn recv(&mut self) -> Option<T>
Sourcepub async fn recv_result(&mut self) -> Result<Option<T>>
pub async fn recv_result(&mut self) -> Result<Option<T>>
Receive one publication while preserving terminal delivery failures.
Unlike Self::recv, a closed feed with a recorded error returns that
error instead of being indistinguishable from a clean shutdown.
Sourcepub fn set_on_error<F>(&self, callback: F)
pub fn set_on_error<F>(&self, callback: F)
Register a callback for background transport/protocol errors.
If an error was already recorded, the callback is invoked immediately. Callback panics are isolated from the websocket worker.
Sourcepub fn resubscribes(&self) -> u64
pub fn resubscribes(&self) -> u64
How many times this subscription successfully reconnected after the initial connect. Non-zero means the stream may have gaps.
Sourcepub fn take_resubscribed(&self) -> bool
pub fn take_resubscribed(&self) -> bool
Reports whether a reconnect/resubscribe happened since the last call and clears the latch. The initial connect does not set the latch.