pub struct CoreWebsocketClient { /* private fields */ }Expand description
Implements a websocket client.
To connect, use Ref<CoreWebsocketClient>::connect which will return an ActiveConnection
which manages the lifecycle of the websocket connection.
Implementations§
Source§impl CoreWebsocketClient
impl 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 ToOwned for CoreWebsocketClient
impl ToOwned for CoreWebsocketClient
Source§type Owned = Ref<CoreWebsocketClient>
type Owned = Ref<CoreWebsocketClient>
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
impl Send for CoreWebsocketClient
impl Sync for CoreWebsocketClient
Auto Trait Implementations§
impl Freeze for CoreWebsocketClient
impl RefUnwindSafe for CoreWebsocketClient
impl Unpin for CoreWebsocketClient
impl UnwindSafe for CoreWebsocketClient
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