pub trait SocketTransport:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn connect(
&self,
request: Request<()>,
timeout: Duration,
runtime: Arc<dyn Runtime>,
) -> BoxFuture<Result<BoxSocket, WsError>>;
fn capabilities(&self) -> Capabilities;
}Expand description
How a WebSocket connection is dialled.
A builder holds one, or leaves it to default_socket_transport, so a
consumer injects nothing unless it wants its own dial. The transport
bounds each of its own steps with the runtime it is given, so one
transport serves clients with different runtimes, and a connect that does
not open within timeout fails as Kind::ConnectTimeout.
Every other failure is the transport’s: a refused upgrade is a
Kind::Refused where the transport can see its
status.
Required Methods§
Sourcefn connect(
&self,
request: Request<()>,
timeout: Duration,
runtime: Arc<dyn Runtime>,
) -> BoxFuture<Result<BoxSocket, WsError>>
fn connect( &self, request: Request<()>, timeout: Duration, runtime: Arc<dyn Runtime>, ) -> BoxFuture<Result<BoxSocket, WsError>>
Open the connection request describes, within timeout.
Sourcefn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
What this transport can do, so a protocol adapts instead of failing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl SocketTransport for TungsteniteTransport
Available on non-WebAssembly only.