pub struct WsFramedStream { /* private fields */ }Expand description
A WebSocket-backed FramedStream.
Uses split read/write halves to avoid mutex contention between the heartbeat task and the main send/recv path:
- Write half (
SplitSink): Shared viaArc<Mutex<_>>betweensend()and the heartbeat task (which sends Ping frames). - Read half (
SplitStream): Owned exclusively byrecv()— no mutex needed. - Heartbeat: Sends Ping on the write half at
ping_interval. Tracks last Pong viaArc<AtomicU64>(epoch millis). Iflast_pongexceedspong_timeout, the connection is closed.
Implementations§
Source§impl WsFramedStream
impl WsFramedStream
Sourcepub fn remote_peer_id(&self) -> &str
pub fn remote_peer_id(&self) -> &str
Get the remote peer ID (from the transport handshake).
Trait Implementations§
Source§impl Debug for WsFramedStream
impl Debug for WsFramedStream
Source§impl Drop for WsFramedStream
impl Drop for WsFramedStream
Source§impl FramedStream for WsFramedStream
impl FramedStream for WsFramedStream
impl Sync for WsFramedStream
Auto Trait Implementations§
impl Freeze for WsFramedStream
impl !RefUnwindSafe for WsFramedStream
impl Send for WsFramedStream
impl Unpin for WsFramedStream
impl UnsafeUnpin for WsFramedStream
impl !UnwindSafe for WsFramedStream
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