pub struct Connection {
pub id: ConnectionId,
pub remote_addr: Option<SocketAddr>,
/* private fields */
}Expand description
A WebSocket connection.
Fields§
§id: ConnectionIdUnique connection identifier
remote_addr: Option<SocketAddr>Remote address
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn state(&self) -> ConnectionState
pub fn state(&self) -> ConnectionState
Get the connection state.
Sourcepub fn send(&self, message: Message) -> WebSocketResult<()>
pub fn send(&self, message: Message) -> WebSocketResult<()>
Send a message to this connection.
Sourcepub fn send_binary<B: Into<Bytes>>(&self, data: B) -> WebSocketResult<()>
pub fn send_binary<B: Into<Bytes>>(&self, data: B) -> WebSocketResult<()>
Send a binary message.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe 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