fn on_request(
        &self,
        request: jsonrpc_http_server::hyper::Request<jsonrpc_http_server::hyper::Body>,
    ) -> RequestMiddlewareAction {
        // Authentificate the websockets connection
        // TODO: Don't use block_on
        if !block_on(Self::auth_ws(&request, &self.states)) {
            return request.into();
        }

        match request.uri().path() {
            "/websockets" => {
                if hyper_tungstenite::is_upgrade_request(&request) {
                    let (response, websocket) = hyper_tungstenite::upgrade(request, None).unwrap();

                    // Handle the WebSocket connection
                    Self::handle_ws(self.sockets.clone(), self.core_sender.clone(), websocket);

                    // Return the response so the spawned future can continue.
                    response.into()
                } else {
                    request.into()
                }
            }
            _ => request.into(),
        }
    }
// This acts as a Middleware to upgrade requests  on `/websockets` to actual WebSockets connections
This acts as a Middleware to upgrade requests  on `/websockets` to actual WebSockets connections
This acts as a Middleware to upgrade requests on ` / websockets ` to actual WebSockets connections
fn on_request(
        &self,
        request: jsonrpc_http_server::hyper::Request<jsonrpc_http_server::hyper::Body>,
    ) -> RequestMiddlewareAction {
        // Authentificate the websockets connection
        // TODO: Don't use block_on
        if !block_on(Self::auth_ws(&request, &self.states)) {
            return request.into();
        }
        match request.uri().path() {
            "/websockets" => {
                if hyper_tungstenite::is_upgrade_request(&request) {
                    let (response, websocket) = hyper_tungstenite::upgrade(request, None).unwrap();
                    // Handle the WebSocket connection
                    Self::handle_ws(self.sockets.clone(), self.core_sender.clone(), websocket);
                    // Return the response so the spawned future can continue.
                    response.into()
                } else {
                    request.into()
                }
            }
            _ => request.into(),
        }
    }
fn on_request ( & self , request : jsonrpc_http_server :: hyper :: Request < jsonrpc_http_server :: hyper :: Body > , ) -> RequestMiddlewareAction { // Authentificate the websockets connection // TODO: Don't use block_on if ! block_on ( Self :: auth_ws ( & request , & self . states ) ) { return request . into ( ) ; } match request . uri ( ) . path ( ) { " " => { if hyper_tungstenite :: is_upgrade_request ( & request ) { let ( response , websocket ) = hyper_tungstenite :: upgrade ( request , None ) . unwrap ( ) ; // Handle the WebSocket connection Self :: handle_ws ( self . sockets . clone ( ) , self . core_sender . clone ( ) , websocket ) ; // Return the response so the spawned future can continue. response . into ( ) } else { request . into ( ) } } _ => request . into ( ) , } }
This acts as a Middleware to upgrade requests  on `/websockets` to actual WebSockets connections
This acts as a Middleware to upgrade requests on ` / websockets ` to actual WebSockets connections
&self
request
jsonrpc_http_server::hyper::Request<jsonrpc_http_server::hyper::Body>