pub struct WebSocketTransport { /* private fields */ }Expand description
Generic WebSocket physical transport.
Implementations§
Source§impl WebSocketTransport
impl WebSocketTransport
pub fn new( transport_id: TransportId, name: Option<String>, config: WebSocketConfig, packet_tx: PacketTx, identity: &Identity, ) -> Self
pub fn name(&self) -> Option<&str>
pub fn local_addr(&self) -> Option<SocketAddr>
pub fn public_url(&self) -> Option<&str>
pub fn stats(&self) -> WebSocketStatsSnapshot
pub async fn start_async(&mut self) -> Result<(), TransportError>
pub async fn stop_async(&mut self) -> Result<(), TransportError>
pub async fn send_async( &self, addr: &TransportAddr, data: &[u8], ) -> Result<usize, TransportError>
pub async fn connect_async( &self, addr: &TransportAddr, ) -> Result<(), TransportError>
pub fn connection_state_sync(&self, addr: &TransportAddr) -> ConnectionState
pub async fn close_connection_async(&self, addr: &TransportAddr)
Trait Implementations§
Source§impl Transport for WebSocketTransport
impl Transport for WebSocketTransport
Source§fn transport_id(&self) -> TransportId
fn transport_id(&self) -> TransportId
Get the transport identifier.
Source§fn transport_type(&self) -> &TransportType
fn transport_type(&self) -> &TransportType
Get the transport type metadata.
Source§fn state(&self) -> TransportState
fn state(&self) -> TransportState
Get the current state.
Source§fn send(
&self,
_addr: &TransportAddr,
_data: &[u8],
) -> Result<(), TransportError>
fn send( &self, _addr: &TransportAddr, _data: &[u8], ) -> Result<(), TransportError>
Send data to a transport address.
Source§fn discover(&self) -> Result<Vec<DiscoveredPeer>, TransportError>
fn discover(&self) -> Result<Vec<DiscoveredPeer>, TransportError>
Discover potential peers (if supported).
Source§fn auto_connect(&self) -> bool
fn auto_connect(&self) -> bool
Whether to auto-connect to peers returned by discover().
Default: false. Concrete transports read from their own config.
Source§fn accept_connections(&self) -> bool
fn accept_connections(&self) -> bool
Whether to accept inbound handshake initiations on this transport.
Default: true (preserves UDP’s current implicit behavior).
Source§fn close_connection(&self, _addr: &TransportAddr)
fn close_connection(&self, _addr: &TransportAddr)
Close a specific connection (connection-oriented transports only). Read more
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocketTransport
impl !UnwindSafe for WebSocketTransport
impl Freeze for WebSocketTransport
impl Send for WebSocketTransport
impl Sync for WebSocketTransport
impl Unpin for WebSocketTransport
impl UnsafeUnpin for WebSocketTransport
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> 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