|
|
@@ -207,6 +207,7 @@ impl RequestHandler for JsonRpcInterface {
|
|
|
|
|
|
match req.method.as_str() {
|
|
|
Some("say_hello") => return self.say_hello(req.id, req.params).await,
|
|
|
+ Some("get_info") => return self.get_info(req.id, req.params).await,
|
|
|
Some(_) | None => return JsonResult::Err(jsonerr(MethodNotFound, None, req.id)),
|
|
|
}
|
|
|
}
|
|
|
@@ -218,6 +219,12 @@ impl JsonRpcInterface {
|
|
|
async fn say_hello(&self, id: Value, _params: Value) -> JsonResult {
|
|
|
JsonResult::Resp(jsonresp(json!("hello world"), id))
|
|
|
}
|
|
|
+
|
|
|
+ //--> {"jsonrpc": "2.0", "method": "poll", "params": [], "id": 42}
|
|
|
+ // <-- {"jsonrpc": "2.0", "result": {"nodeID": [], "nodeinfo" [], "id": 42}
|
|
|
+ async fn get_info(&self, id: Value, _params: Value) -> JsonResult {
|
|
|
+ JsonResult::Resp(jsonresp(json!("get_info"), id))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
fn main() -> Result<()> {
|