pub trait WebSocketHandler: Send + Sync {
// Required method
fn handle<'life0, 'async_trait>(
&'life0 self,
req: Request,
websocket: WebSocketConnection,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Available on crate feature
websocket only.Expand description
Core WebSocket handler trait that receives both request context and WebSocket connection.
This trait is implemented automatically for functions that match the signature
requirements through the UniversalWebSocketHandler trait.
§Implementation Note
You typically don’t implement this trait directly. Instead, use the
UniversalWebSocketHandler trait which provides automatic conversion.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".