pub struct WebSocketHandle {
pub id: String,
pub url: String,
pub connected: Arc<Mutex<bool>>,
}Expand description
WebSocket connection handle
Fields§
§id: StringUnique connection ID
url: StringURL of the WebSocket server
connected: Arc<Mutex<bool>>Whether the connection is active
Implementations§
Source§impl WebSocketHandle
impl WebSocketHandle
Sourcepub async fn send_text(&self, _message: String) -> Result<(), WebSocketError>
pub async fn send_text(&self, _message: String) -> Result<(), WebSocketError>
Send a text message through the WebSocket
§Errors
Returns WebSocketError::SendFailed if the connection is not active or sending fails.
Sourcepub async fn send_binary(&self, _data: Vec<u8>) -> Result<(), WebSocketError>
pub async fn send_binary(&self, _data: Vec<u8>) -> Result<(), WebSocketError>
Send binary data through the WebSocket
§Errors
Returns WebSocketError::SendFailed if the connection is not active or sending fails.
Trait Implementations§
Source§impl Clone for WebSocketHandle
impl Clone for WebSocketHandle
Source§fn clone(&self) -> WebSocketHandle
fn clone(&self) -> WebSocketHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WebSocketHandle
impl !UnwindSafe for WebSocketHandle
impl Freeze for WebSocketHandle
impl Send for WebSocketHandle
impl Sync for WebSocketHandle
impl Unpin for WebSocketHandle
impl UnsafeUnpin for WebSocketHandle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Inspectable for T
impl<T> Inspectable for T
Source§fn inspect_if(self, condition: bool, label: &str) -> Selfwhere
Self: Debug,
fn inspect_if(self, condition: bool, label: &str) -> Selfwhere
Self: Debug,
Conditionally inspect this value
Source§fn inspect_with<F>(self, label: &str, f: F) -> Self
fn inspect_with<F>(self, label: &str, f: F) -> Self
Inspect with a custom formatter