From 598f9e2d47da80f2bec2ead9c2fe215eff157936 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Mon, 20 Nov 2023 23:15:10 +0300 Subject: jsonrpc: add Codec struct for reading from and writing to the connection --- jsonrpc/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'jsonrpc/README.md') diff --git a/jsonrpc/README.md b/jsonrpc/README.md index 52a9146..d937071 100644 --- a/jsonrpc/README.md +++ b/jsonrpc/README.md @@ -9,7 +9,7 @@ use std::sync::Arc; use serde_json::Value; -use karyons_jsonrpc::{JsonRPCError, Server, Client, register_service}; +use karyons_jsonrpc::{JsonRPCError, Server, Client, register_service, ServerConfig, ClientConfig}; struct HelloWorld {} @@ -27,7 +27,8 @@ let ex = Arc::new(smol::Executor::new()); // Creates a new server let endpoint = "tcp://127.0.0.1:60000".parse().unwrap(); -let server = Server::new_with_endpoint(&endpoint, ex.clone()).await.unwrap(); +let config = ServerConfig::default(); +let server = Server::new_with_endpoint(&endpoint, config, ex.clone()).await.unwrap(); // Register the HelloWorld service register_service!(HelloWorld, say_hello); @@ -41,7 +42,8 @@ ex.run(server.start()); ////////////////// // Creates a new client let endpoint = "tcp://127.0.0.1:60000".parse().unwrap(); -let client = Client::new_with_endpoint(&endpoint, None).await.unwrap(); +let config = ClientConfig::default(); +let client = Client::new_with_endpoint(&endpoint, config).await.unwrap(); let result: String = client.call("HelloWorld.say_hello", "world".to_string()).await.unwrap(); -- cgit v1.2.3