async fn request(
        &self,
        request: serde_json::Value,
    ) -> Result<oneshot::Receiver<Result<AbsintheWSResponse>>> {
        let message_id = self.ws_state.incr_message_id();
        let graphql_msg = AbsintheWSRequest::new(
            self.ws_state.client_id,
            message_id,
            AbsintheTopic::Control,
            AbsintheEvent::Doc,
            Some(request),
        );
        // create a channel where message broker will push a response when it gets one
        let (for_broker, callback_channel) = oneshot::channel();
        let (ready_tx, ready_rx) = oneshot::channel();
        let broker_link = self.ws_state.message_broker.link.clone();
        // register that channel in the broker with our message id
        trace!(id = %message_id, "attached id");
        broker_link
            .send(BrokerAction::RegisterRequest(
                message_id, for_broker, ready_tx,
            ))
            .map_err(|_| ProtocolError("Could not register request with broker"))?;
        // send the query
        self.ws_state
            .ws_outgoing_sender
            .send((graphql_msg, Some(ready_rx)))
            .map_err(|_| ProtocolError("Request failed to send over channel"))?;
        // return response from the message broker when it comes
        Ok(callback_channel)
    }
/// Execute a serialized NashProtocol request via websockets
Execute a serialized NashProtocol request via websockets
Execute a serialized NashProtocol request via websockets
async fn request(
        &self,
        request: serde_json::Value,
    ) -> Result<oneshot::Receiver<Result<AbsintheWSResponse>>> {
        let message_id = self.ws_state.incr_message_id();
        let graphql_msg = AbsintheWSRequest::new(
            self.ws_state.client_id,
            message_id,
            AbsintheTopic::Control,
            AbsintheEvent::Doc,
            Some(request),
        );
        // create a channel where message broker will push a response when it gets one
        let (for_broker, callback_channel) = oneshot::channel();
        let (ready_tx, ready_rx) = oneshot::channel();
        let broker_link = self.ws_state.message_broker.link.clone();
        // register that channel in the broker with our message id
        trace!(id = %message_id, "attached id");
        broker_link
            .send(BrokerAction::RegisterRequest(
                message_id, for_broker, ready_tx,
            ))
            .map_err(|_| ProtocolError("Could not register request with broker"))?;
        // send the query
        self.ws_state
            .ws_outgoing_sender
            .send((graphql_msg, Some(ready_rx)))
            .map_err(|_| ProtocolError("Request failed to send over channel"))?;
        // return response from the message broker when it comes
        Ok(callback_channel)
    }
async fn request ( & self , request : serde_json :: Value , ) -> Result < oneshot :: Receiver < Result < AbsintheWSResponse > > > { let message_id = self . ws_state . incr_message_id ( ) ; let graphql_msg = AbsintheWSRequest :: new ( self . ws_state . client_id , message_id , AbsintheTopic :: Control , AbsintheEvent :: Doc , Some ( request ) , ) ; // create a channel where message broker will push a response when it gets one let ( for_broker , callback_channel ) = oneshot :: channel ( ) ; let ( ready_tx , ready_rx ) = oneshot :: channel ( ) ; let broker_link = self . ws_state . message_broker . link . clone ( ) ; // register that channel in the broker with our message id trace ! ( id message_id " " ) ; broker_link . send ( BrokerAction :: RegisterRequest ( message_id , for_broker , ready_tx , ) ) . map_err ( | _ | ProtocolError ( " " ) ) ? ; // send the query self . ws_state . ws_outgoing_sender . send ( ( graphql_msg , Some ( ready_rx ) ) ) . map_err ( | _ | ProtocolError ( " " ) ) ? ; // return response from the message broker when it comes Ok ( callback_channel ) }
Execute a serialized NashProtocol request via websockets
Execute a serialized NashProtocol request via websockets
&self
request
serde_json::Value