pub struct ConnectionInfo {
pub id: ConnectionId,
pub addr: SocketAddr,
pub connected_at: u64,
pub protocol: Option<String>,
}Expand description
Metadata about a WebSocket connection.
Contains information about when the connection was established, the client’s address, and optional protocol information.
§Examples
use wsforge::connection::ConnectionInfo;
use std::net::SocketAddr;
let info = ConnectionInfo {
id: "conn_0".to_string(),
addr: "127.0.0.1:8080".parse().unwrap(),
connected_at: 1634567890,
protocol: Some("websocket".to_string()),
};
println!("Connection {} from {}", info.id, info.addr);Fields§
§id: ConnectionIdUnique identifier for this connection
addr: SocketAddrSocket address of the connected client
connected_at: u64Unix timestamp when the connection was established
protocol: Option<String>Optional protocol information (e.g., “websocket”, “wss”)
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
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 moreSource§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Source§impl<'de> Deserialize<'de> for ConnectionInfo
impl<'de> Deserialize<'de> for ConnectionInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConnectionInfo
impl RefUnwindSafe for ConnectionInfo
impl Send for ConnectionInfo
impl Sync for ConnectionInfo
impl Unpin for ConnectionInfo
impl UnwindSafe for ConnectionInfo
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