Skip to main content

BoxedWebSocketConnection

Type Alias BoxedWebSocketConnection 

Source
pub type BoxedWebSocketConnection = Box<dyn WebSocketConnection>;
Available on crate feature websocket only.
Expand description

A type-erased WebSocketConnection.

Aliased Type§

pub struct BoxedWebSocketConnection(/* private fields */);

Trait Implementations§

Source§

impl WebSocketConnection for BoxedWebSocketConnection

Source§

fn send(&mut self, frame: Frame) -> WasmBoxedFuture<'_, Result<()>>

Write one frame.
Source§

fn recv(&mut self) -> WasmBoxedFuture<'_, Result<Option<Frame>>>

Read the next frame; Ok(None) means the peer ended the stream.
Source§

fn close( &mut self, frame: Option<CloseFrame>, ) -> WasmBoxedFuture<'_, Result<()>>

Completes a close handshake. Callers must avoid repeated closes; backends may return an error for an already closed socket.