pub struct WebSocketSubscriptionStream { /* private fields */ }Expand description
A connected WebSocket subscription whose background reader surfaces delivered messages.
Implementations§
Source§impl WebSocketSubscriptionStream
impl WebSocketSubscriptionStream
Sourcepub fn open(
address: &str,
channel: &str,
accepted_schemas: Vec<SchemaId>,
) -> Result<Self, SdkError>
pub fn open( address: &str, channel: &str, accepted_schemas: Vec<SchemaId>, ) -> Result<Self, SdkError>
Connects to the ws:// address, performs the liminal handshake,
subscribes to channel, and starts the background reader.
Deliveries the server coalesces with the SubscribeAck are retained
and surfaced first, never dropped.
§Errors
Returns SdkError::Connection when the client unit refuses the
open or the socket cannot be opened, and SdkError::Protocol when
the handshake or subscribe is rejected.
Sourcepub fn recv_timeout(
&self,
timeout: Duration,
) -> Result<WebSocketDeliveredMessage, SdkError>
pub fn recv_timeout( &self, timeout: Duration, ) -> Result<WebSocketDeliveredMessage, SdkError>
Blocks up to timeout for the next delivered message.
§Errors
Returns SdkError::Connection when no message arrives within
timeout or the background reader has stopped.
Sourcepub const fn subscription_id(&self) -> u64
pub const fn subscription_id(&self) -> u64
The server-assigned id for this subscription.
Sourcepub fn reconnect_state(&self) -> ReconnectState
pub fn reconnect_state(&self) -> ReconnectState
The client unit’s reconnect state for this subscription’s connection.
Trait Implementations§
Source§impl Debug for WebSocketSubscriptionStream
impl Debug for WebSocketSubscriptionStream
Source§impl Drop for WebSocketSubscriptionStream
impl Drop for WebSocketSubscriptionStream
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocketSubscriptionStream
impl !Sync for WebSocketSubscriptionStream
impl !UnwindSafe for WebSocketSubscriptionStream
impl Freeze for WebSocketSubscriptionStream
impl Send for WebSocketSubscriptionStream
impl Unpin for WebSocketSubscriptionStream
impl UnsafeUnpin for WebSocketSubscriptionStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more