pub fn spawn_websocket<T, F>(req: Request<Body>, f: F) -> Response<Body>
where
    T: Default + Send + Sync + 'static,
    F: FnMut(Message<T>) -> Pin<Box<dyn Future<Output = Result<Option<Message<T>>, Error>> + Send>>
        + Send
        + 'static,
{
    spawn_websocket_inner(req, f, None)
}
/// This is a high level function that spawn a websocket handler from
/// appropriate HTTP request (e.g. websocket upgrade request).
/// Each incomming message can be then processed with function f,
/// which returns future with optional response to this message.
/// This function returns immediate HTTP response, which is either of status
/// 101 Protocol upgrade, if websocket handshake is OK, or of status 400, if
/// handshake was no successful.
///
/// All messages in this websocket share (guarded by RwLock) context of type T
This is a high level function that spawn a websocket handler from
appropriate HTTP request .
Each incomming message can be then processed with function f,
which returns future with optional response to this message.
This function returns immediate HTTP response, which is either of status
101 Protocol upgrade, if websocket handshake is OK, or of status 400, if
handshake was no successful.

All messages in this websocket share (guarded by RwLock) context of type T
This is a high level function that spawn a websocket handler from appropriate HTTP request . Each incomming message can be then processed with function f which returns future with optional response to this message . This function returns immediate HTTP response which is either of status 101 Protocol upgrade if websocket handshake is OK or of status 400 if handshake was no successful . All messages in this websocket share ( guarded by RwLock ) context of type T
pub fn spawn_websocket<T, F>(req: Request<Body>, f: F) -> Response<Body>
where
    T: Default + Send + Sync + 'static,
    F: FnMut(Message<T>) -> Pin<Box<dyn Future<Output = Result<Option<Message<T>>, Error>> + Send>>
        + Send
        + 'static,
{
    spawn_websocket_inner(req, f, None)
}
pub fn spawn_websocket < T , F > ( req : Request < Body > , f : F ) -> Response < Body > where T : Default + Send + Sync + ' static , F : FnMut ( Message < T > ) -> Pin < Box < dyn Future < Output = Result < Option < Message < T > > , Error > > + Send > > + Send + ' static , { spawn_websocket_inner ( req , f , None ) }
This is a high level function that spawn a websocket handler from
appropriate HTTP request (e.g.
This is a high level function that spawn a websocket handler from appropriate HTTP request ( e . g .
req
Request<Body>
f
F
req
Request<Body>
f
F