pub struct SessionInfo {
pub id: SessionId,
pub node_id: NodeId,
pub user_id: Option<String>,
pub status: SessionStatus,
pub subscription_count: u32,
pub created_at: DateTime<Utc>,
pub last_active_at: DateTime<Utc>,
pub client_ip: Option<String>,
pub user_agent: Option<String>,
}Expand description
Information about a WebSocket session.
Fields§
§id: SessionIdUnique session ID.
node_id: NodeIdNode hosting this session.
user_id: Option<String>User ID if authenticated.
status: SessionStatusCurrent status.
subscription_count: u32Number of active subscriptions.
created_at: DateTime<Utc>When the session was created.
last_active_at: DateTime<Utc>When the session was last active.
client_ip: Option<String>Client IP address.
user_agent: Option<String>User agent string.
Implementations§
Source§impl SessionInfo
impl SessionInfo
Sourcepub fn with_user_id(self, user_id: impl Into<String>) -> Self
pub fn with_user_id(self, user_id: impl Into<String>) -> Self
Set user ID after authentication.
Sourcepub fn with_client_info(
self,
client_ip: Option<String>,
user_agent: Option<String>,
) -> Self
pub fn with_client_info( self, client_ip: Option<String>, user_agent: Option<String>, ) -> Self
Set client metadata.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Mark session as disconnected.
Sourcepub fn reconnecting(&mut self)
pub fn reconnecting(&mut self)
Mark session as reconnecting.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if session is connected.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Check if session is authenticated.
Trait Implementations§
Source§impl Clone for SessionInfo
impl Clone for SessionInfo
Source§fn clone(&self) -> SessionInfo
fn clone(&self) -> SessionInfo
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 moreAuto Trait Implementations§
impl Freeze for SessionInfo
impl RefUnwindSafe for SessionInfo
impl Send for SessionInfo
impl Sync for SessionInfo
impl Unpin for SessionInfo
impl UnwindSafe for SessionInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more