pub trait WsConn: Send {
// Required methods
fn send_text(
&mut self,
text: String,
) -> impl Future<Output = Result<(), WsError>> + Send;
fn send_pong(
&mut self,
payload: Bytes,
) -> impl Future<Output = Result<(), WsError>> + Send;
fn recv(
&mut self,
) -> impl Future<Output = Result<Option<WsFrame>, WsError>> + Send;
fn close(&mut self) -> impl Future<Output = Result<(), WsError>> + Send;
}Expand description
A full-duplex WebSocket connection.
This trait is intentionally minimal so tests can use a fake connection without depending on a concrete WebSocket implementation.
Required Methods§
Sourcefn send_text(
&mut self,
text: String,
) -> impl Future<Output = Result<(), WsError>> + Send
fn send_text( &mut self, text: String, ) -> impl Future<Output = Result<(), WsError>> + Send
Send a text frame.
Sourcefn send_pong(
&mut self,
payload: Bytes,
) -> impl Future<Output = Result<(), WsError>> + Send
fn send_pong( &mut self, payload: Bytes, ) -> impl Future<Output = Result<(), WsError>> + Send
Send a pong control frame with the supplied ping payload.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".