pub struct WebSocketContext { /* private fields */ }Expand description
A single WebSocket connection attempt, with its own read loop.
Implementations§
Source§impl WebSocketContext
impl WebSocketContext
Sourcepub fn new(end_point: SocketAddr, events: ConnectionEventSenders) -> Self
pub fn new(end_point: SocketAddr, events: ConnectionEventSenders) -> Self
Creates a context for the given endpoint.
Sourcepub fn new_with_uri(
end_point: SocketAddr,
uri: String,
events: ConnectionEventSenders,
) -> Self
pub fn new_with_uri( end_point: SocketAddr, uri: String, events: ConnectionEventSenders, ) -> Self
Creates a context for the given endpoint and URI. The URI is passed in
because it needs the host name, which end_point doesn’t have.
Sourcepub fn end_point(&self) -> SocketAddr
pub fn end_point(&self) -> SocketAddr
The endpoint this context is connected to.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the context has been cancelled.
Sourcepub fn notify_disconnected(&self, user_initiated: bool)
pub fn notify_disconnected(&self, user_initiated: bool)
Raises the Disconnected event exactly once.
Sourcepub fn start(self: Arc<Self>, socket: Arc<dyn WebSocketSocket>)
pub fn start(self: Arc<Self>, socket: Arc<dyn WebSocketSocket>)
Starts the read loop.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WebSocketContext
impl !RefUnwindSafe for WebSocketContext
impl !UnwindSafe for WebSocketContext
impl Send for WebSocketContext
impl Sync for WebSocketContext
impl Unpin for WebSocketContext
impl UnsafeUnpin for WebSocketContext
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