pub struct ConnectionContext<S, U>{
pub conn_id: ConnectionId,
pub user_id: U,
pub topic: Topic,
pub app_state: Arc<S>,
pub sink: WsSink,
}Expand description
A context object passed to message handler methods.
It contains all the relevant state for a single connection, allowing the handler to access application state, user information, and the client’s WebSocket sink for direct communication.
Fields§
§conn_id: ConnectionIdThe unique ID of the connection.
user_id: UThe ID of the authenticated user. Its type is defined by the MessageHandler.
topic: TopicThe topic this connection is subscribed to.
app_state: Arc<S>A clone of the shared application state.
sink: WsSinkA clone of the WebSocket sink for sending messages directly to the client.
Trait Implementations§
Auto Trait Implementations§
impl<S, U> Freeze for ConnectionContext<S, U>where
U: Freeze,
impl<S, U> !RefUnwindSafe for ConnectionContext<S, U>
impl<S, U> Send for ConnectionContext<S, U>
impl<S, U> Sync for ConnectionContext<S, U>
impl<S, U> Unpin for ConnectionContext<S, U>where
U: Unpin,
impl<S, U> !UnwindSafe for ConnectionContext<S, U>
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