pub struct Connection {
pub id: String,
pub receiver: SplitSink<WebSocket, Message>,
}Expand description
type for each individual connection.
Fields§
§id: String§receiver: SplitSink<WebSocket, Message>Implementations§
Source§impl Connection
impl Connection
Sourcepub fn create(id: String, receiver: SplitSink<WebSocket, Message>) -> Self
pub fn create(id: String, receiver: SplitSink<WebSocket, Message>) -> Self
create a connection:
pub async fn send(&mut self, message: Utf8Bytes) -> Result<(), Error>
Sourcepub async fn send_if<F>(&mut self, message: Utf8Bytes, condition: F)
pub async fn send_if<F>(&mut self, message: Utf8Bytes, condition: F)
send the text message if the given condition in it’s closure is true.
Sourcepub async fn send_if_not<F>(&mut self, message: Utf8Bytes, condition: F)
pub async fn send_if_not<F>(&mut self, message: Utf8Bytes, condition: F)
sen the text message if the given condition in it’s closure is true.
Sourcepub async fn ping_if<F>(&mut self, message: Bytes, condition: F)
pub async fn ping_if<F>(&mut self, message: Bytes, condition: F)
send the ping if the given condition in it’s closure is true.
Sourcepub async fn ping_if_not<F>(&mut self, message: Bytes, condition: F)
pub async fn ping_if_not<F>(&mut self, message: Bytes, condition: F)
sen the ping if the given condition in it’s closure is true.
Sourcepub async fn pong_if<F>(&mut self, message: Bytes, condition: F)
pub async fn pong_if<F>(&mut self, message: Bytes, condition: F)
send the pong if the given condition in it’s closure is true.
Sourcepub async fn pong_if_not<F>(&mut self, message: Bytes, condition: F)
pub async fn pong_if_not<F>(&mut self, message: Bytes, condition: F)
sen the pong if the given condition in it’s closure is true.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl !UnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
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