pub struct Client { /* private fields */ }Expand description
Realtime websocket client.
Implementations§
Source§impl Client
impl Client
pub fn new( ws_url: impl Into<String>, api_url: impl Into<String>, credentials: Option<Credentials>, max_queue: Option<usize>, ) -> Self
pub fn with_timeout( ws_url: impl Into<String>, api_url: impl Into<String>, credentials: Option<Credentials>, max_queue: Option<usize>, timeout: Duration, ) -> Self
Sourcepub async fn subscribe_raw(
&self,
channel: &str,
) -> Result<TypedSubscription<Vec<u8>>>
pub async fn subscribe_raw( &self, channel: &str, ) -> Result<TypedSubscription<Vec<u8>>>
Subscribe to a protobuf channel and receive raw publication payloads.
Returns only after the initial websocket handshake and channel subscription succeed.
Sourcepub async fn subscribe_proto<T, F>(
&self,
channel: &str,
decode: F,
) -> Result<TypedSubscription<T>>
pub async fn subscribe_proto<T, F>( &self, channel: &str, decode: F, ) -> Result<TypedSubscription<T>>
Subscribe to a protobuf Centrifugo channel and decode publications.
Returns only after the initial websocket handshake and channel subscription succeed.
Sourcepub async fn subscribe_proto_with_options<T, F>(
&self,
channel: &str,
decode: F,
auto_reconnect: bool,
) -> Result<TypedSubscription<T>>
pub async fn subscribe_proto_with_options<T, F>( &self, channel: &str, decode: F, auto_reconnect: bool, ) -> Result<TypedSubscription<T>>
Subscribe with optional auto-reconnect control.
Snapshot-then-stream sets auto_reconnect=false so it can rebuild REST
state between reconnect attempts.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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