pub trait SocketTransport:
Send
+ Sync
+ 'static {
// Required methods
fn set_addr(&self, addr: Option<String>);
fn close(&self);
fn intended_connection_state(
&self,
) -> Cell<SocketConnectionStatus, CellImmutable>;
fn actual_connection_state(
&self,
) -> Cell<SocketConnectionStatus, CellImmutable>;
fn send(&self, frame: WsFrame) -> Result<(), String>;
fn read_rx(&self) -> Receiver<WsFrame>;
}Expand description
Abstraction over a WebSocket connection with auto-reconnect behaviour.
Implemented by AutoReconnectSocket (native) and WasmSocket (browser).
Object-safe: uses callback-based subscriptions instead of channel returns.
Required Methods§
Sourcefn intended_connection_state(
&self,
) -> Cell<SocketConnectionStatus, CellImmutable>
fn intended_connection_state( &self, ) -> Cell<SocketConnectionStatus, CellImmutable>
Intended connection state requested by the caller.
Sourcefn actual_connection_state(&self) -> Cell<SocketConnectionStatus, CellImmutable>
fn actual_connection_state(&self) -> Cell<SocketConnectionStatus, CellImmutable>
Actual observed connection state of the transport.