pub struct ActiveConnection<'a, C: WebsocketClientCallback> {
pub client: Ref<CoreWebsocketClient>,
/* private fields */
}Expand description
Represents a live websocket connection.
This manages the lifetime of the callback, ensuring it outlives the connection.
Fields§
§client: Ref<CoreWebsocketClient>Methods from Deref<Target = CoreWebsocketClient>§
Sourcepub fn notify_connected(&self) -> bool
pub fn notify_connected(&self) -> bool
Call the connect callback function, forward the callback returned value
Sourcepub fn notify_disconnected(&self)
pub fn notify_disconnected(&self)
Notify the callback function of a disconnect. This must be called at the end of an active websocket connection lifecycle, to free resources.
NOTE: This does not actually disconnect, use the Self::disconnect function for that.
Sourcepub fn notify_error(&self, msg: &str)
pub fn notify_error(&self, msg: &str)
Call the error callback function, this is not a terminating request you must use
CoreWebsocketClient::notify_disconnected to terminate the connection.
Sourcepub fn notify_read(&self, data: &[u8]) -> bool
pub fn notify_read(&self, data: &[u8]) -> bool
Call the read callback function, forward the callback returned value.
pub fn write(&self, data: &[u8]) -> bool
pub fn disconnect(&self) -> bool
Trait Implementations§
Source§impl<'a, C: WebsocketClientCallback> Deref for ActiveConnection<'a, C>
impl<'a, C: WebsocketClientCallback> Deref for ActiveConnection<'a, C>
Source§impl<'a, C: WebsocketClientCallback> Drop for ActiveConnection<'a, C>
impl<'a, C: WebsocketClientCallback> Drop for ActiveConnection<'a, C>
Auto Trait Implementations§
impl<'a, C> Freeze for ActiveConnection<'a, C>
impl<'a, C> RefUnwindSafe for ActiveConnection<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for ActiveConnection<'a, C>
impl<'a, C> Sync for ActiveConnection<'a, C>
impl<'a, C> Unpin for ActiveConnection<'a, C>
impl<'a, C> !UnwindSafe for ActiveConnection<'a, 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