pub struct WebSocketState(/* private fields */);
Expand description
WebSocketState
Implementations§
Source§impl WebSocketState
impl WebSocketState
Sourcepub async fn insert(&self, conn: &WebSocketConnection) -> WebSocketHandle
pub async fn insert(&self, conn: &WebSocketConnection) -> WebSocketHandle
Insert a WebSocketConnection
Sourcepub async fn delete(
&self,
handle: &WebSocketHandle,
) -> Option<WebSocketConnection>
pub async fn delete( &self, handle: &WebSocketHandle, ) -> Option<WebSocketConnection>
Remove a WebSocketConnection
Sourcepub async fn send_string(
&self,
msg: String,
handle: WebSocketHandle,
timeout: Duration,
) -> Result<()>
pub async fn send_string( &self, msg: String, handle: WebSocketHandle, timeout: Duration, ) -> Result<()>
Send a String
to a particular client
Sourcepub async fn send_json<T: Serialize>(
&self,
msg: &T,
handle: WebSocketHandle,
timeout: Duration,
) -> Result<()>
pub async fn send_json<T: Serialize>( &self, msg: &T, handle: WebSocketHandle, timeout: Duration, ) -> Result<()>
Send a type with T: Serialize as json
Sourcepub async fn send_bytes(
&self,
bytes: Vec<u8>,
handle: WebSocketHandle,
timeout: Duration,
) -> Result<()>
pub async fn send_bytes( &self, bytes: Vec<u8>, handle: WebSocketHandle, timeout: Duration, ) -> Result<()>
Send bytes
Sourcepub async fn send(
&self,
msg: Message,
handle: WebSocketHandle,
timeout: Duration,
) -> Result<()>
pub async fn send( &self, msg: Message, handle: WebSocketHandle, timeout: Duration, ) -> Result<()>
Send a websockets Message
.
Sourcepub async fn send_all_string(
&self,
msg: String,
timeout: Duration,
) -> Vec<Result<()>> ⓘ
pub async fn send_all_string( &self, msg: String, timeout: Duration, ) -> Vec<Result<()>> ⓘ
Send every client a String
.
Sourcepub async fn send_all_json<T: Serialize + Clone>(
&self,
msg: T,
timeout: Duration,
) -> Vec<Result<()>> ⓘ
pub async fn send_all_json<T: Serialize + Clone>( &self, msg: T, timeout: Duration, ) -> Vec<Result<()>> ⓘ
Send every client a T: Serialize as JSON.
Trait Implementations§
Source§impl Clone for WebSocketState
impl Clone for WebSocketState
Source§fn clone(&self) -> WebSocketState
fn clone(&self) -> WebSocketState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WebSocketState
impl Debug for WebSocketState
Auto Trait Implementations§
impl Freeze for WebSocketState
impl !RefUnwindSafe for WebSocketState
impl Send for WebSocketState
impl Sync for WebSocketState
impl Unpin for WebSocketState
impl !UnwindSafe for WebSocketState
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