aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/src/client.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@proton.me>2023-11-30 22:52:53 +0300
committerhozan23 <hozan23@proton.me>2023-11-30 22:52:53 +0300
commit7d6c0e68a19ad5e2e4e05cfc219d446be6ff2286 (patch)
tree2f7bfc34ca033b059702fc26bc18170dc118c20e /jsonrpc/src/client.rs
parent8c70a0d379b21541b5b2d1d37ff7fc61ca311cd4 (diff)
jsonrpc: Enhance the API and add support for TCP, Unix, and TLS protocols.
Diffstat (limited to 'jsonrpc/src/client.rs')
-rw-r--r--jsonrpc/src/client.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/jsonrpc/src/client.rs b/jsonrpc/src/client.rs
index 939d177..0061002 100644
--- a/jsonrpc/src/client.rs
+++ b/jsonrpc/src/client.rs
@@ -2,7 +2,7 @@ use log::debug;
use serde::{de::DeserializeOwned, Serialize};
use karyons_core::util::random_32;
-use karyons_net::{dial, Conn, Endpoint};
+use karyons_net::Conn;
use crate::{
codec::{Codec, CodecConfig},
@@ -22,7 +22,7 @@ pub struct Client {
}
impl Client {
- /// Creates a new RPC client.
+ /// Creates a new RPC client by passing a Tcp, Unix, or Tls connection.
pub fn new(conn: Conn, config: ClientConfig) -> Self {
let codec_config = CodecConfig {
max_allowed_buffer_size: 0,
@@ -32,17 +32,6 @@ impl Client {
Self { codec, config }
}
- /// Creates a new RPC client using the provided endpoint.
- pub async fn new_with_endpoint(endpoint: &Endpoint, config: ClientConfig) -> Result<Self> {
- let conn = dial(endpoint).await?;
- let codec_config = CodecConfig {
- max_allowed_buffer_size: 0,
- ..Default::default()
- };
- let codec = Codec::new(conn, codec_config);
- Ok(Self { codec, config })
- }
-
/// Calls the named method, waits for the response, and returns the result.
pub async fn call<T: Serialize + DeserializeOwned, V: DeserializeOwned>(
&self,