pub struct PushClient<C: ChannelKind> { /* private fields */ }Expand description
Implementations§
Source§impl<C: ChannelKind> PushClient<C>
impl<C: ChannelKind> PushClient<C>
pub fn new(config: ClientConfig) -> Self
Sourcepub fn on(&mut self, channel: C, receiver: impl ChannelReceiver<C>)
pub fn on(&mut self, channel: C, receiver: impl ChannelReceiver<C>)
Register a handler for a channel. Must be called before connect().
Sourcepub async fn connect(&mut self) -> Result<(), ConnectError>
pub async fn connect(&mut self) -> Result<(), ConnectError>
Connect to the server. Performs auth handshake and starts the receive loop.
Sourcepub async fn send(&self, frame: Frame<C>) -> Result<(), SendError>
pub async fn send(&self, frame: Frame<C>) -> Result<(), SendError>
Send a frame to the server (client → server).
Sourcepub async fn subscribe(&self, channels: &[C]) -> Result<(), SendError>
pub async fn subscribe(&self, channels: &[C]) -> Result<(), SendError>
Subscribe to additional channels after connect.
Sourcepub async fn unsubscribe(&self, channels: &[C]) -> Result<(), SendError>
pub async fn unsubscribe(&self, channels: &[C]) -> Result<(), SendError>
Unsubscribe from channels.
Sourcepub async fn disconnect(&mut self) -> Result<(), SendError>
pub async fn disconnect(&mut self) -> Result<(), SendError>
Graceful disconnect.
Sourcepub fn state(&self) -> ConnectionState
pub fn state(&self) -> ConnectionState
Current connection state.
Auto Trait Implementations§
impl<C> Freeze for PushClient<C>
impl<C> !RefUnwindSafe for PushClient<C>
impl<C> Send for PushClient<C>
impl<C> Sync for PushClient<C>
impl<C> Unpin for PushClient<C>
impl<C> UnsafeUnpin for PushClient<C>
impl<C> !UnwindSafe for PushClient<C>
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