We're ready to deploy our JsonRpcInterface. But right now now it just returns JsonError::MethodNotFound. So before testing out the JSON-RPC, let's implement some methods.

We'll start with a simple pong method that replies to ping.

    async fn pong(&self, id: Value, _params: Value) -> JsonResult {
        JsonResponse::new(json!("pong"), id).into()

And add it to handle_request():

        match req.method.as_str() {
            Some("ping") => self.pong(, req.params).await,
            Some(_) | None => JsonError::new(ErrorCode::MethodNotFound, None,,