pub fn send_request(
        &mut self,
        stream: &mut BufStream<TcpStream>,
        method: String,
        params: Option<Value>,
        connection_id: Option<String>,
    ) -> Result<(), String> {
        let request_id = match connection_id {
            None => "0".to_string(),
            Some(id) => id,
        };
        let req = RpcRequest {
            id: request_id.clone(),
            jsonrpc: "2.0".to_string(),
            method: method,
            params: Some(serde_json::to_value(params).unwrap()),
        };
        let req_str = serde_json::to_string(&req).unwrap();
        trace!(
            "{} - Requesting: {}",
            self.id,
            req_str
        );
        return self.write_message(req_str, stream);
    }
/// Send a Request
// params is the method parameters in serde_json string
Send a Request
params is the method parameters in serde_json string
Send a Request params is the method parameters in serde_json string
pub fn send_request(
        &mut self,
        stream: &mut BufStream<TcpStream>,
        method: String,
        params: Option<Value>,
        connection_id: Option<String>,
    ) -> Result<(), String> {
        let request_id = match connection_id {
            None => "0".to_string(),
            Some(id) => id,
        };
        let req = RpcRequest {
            id: request_id.clone(),
            jsonrpc: "2.0".to_string(),
            method: method,
            params: Some(serde_json::to_value(params).unwrap()),
        };
        let req_str = serde_json::to_string(&req).unwrap();
        trace!(
            "{} - Requesting: {}",
            self.id,
            req_str
        );
        return self.write_message(req_str, stream);
    }
pub fn send_request ( & mut self , stream : & mut BufStream < TcpStream > , method : String , params : Option < Value > , connection_id : Option < String > , ) -> Result < ( ) , String > { let request_id = match connection_id { None => " " . to_string ( ) , Some ( id ) => id , } ; let req = RpcRequest { id : request_id . clone ( ) , jsonrpc : " " . to_string ( ) , method : method , params : Some ( serde_json :: to_value ( params ) . unwrap ( ) ) , } ; let req_str = serde_json :: to_string ( & req ) . unwrap ( ) ; trace ! ( " " self id req_str ) ; return self . write_message ( req_str , stream ) ; }
Send a Request
params is the method parameters in serde_json string
Send a Request params is the method parameters in serde_json string
&mut self
stream
&mut BufStream<TcpStream>
method
String
params
Option<Value>
connection_id
Option<String>