aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/README.md
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-06-13 05:52:48 +0200
committerhozan23 <hozan23@karyontech.net>2024-06-13 05:52:48 +0200
commit1c27f751c30196e2c421ae420dacbc4ff25f0fc7 (patch)
treee9a34bea9e6fd45d53a4ad1a7a4e75857ad2fe9a /jsonrpc/README.md
parentd6a280f69a6685d5b4da5366626fb76a27f0cc07 (diff)
jsonrpc: spread out comments and clean up
Diffstat (limited to 'jsonrpc/README.md')
-rw-r--r--jsonrpc/README.md19
1 files changed, 16 insertions, 3 deletions
diff --git a/jsonrpc/README.md b/jsonrpc/README.md
index 5fc6847..b4ee580 100644
--- a/jsonrpc/README.md
+++ b/jsonrpc/README.md
@@ -13,6 +13,15 @@ features:
- Allows passing an `async_executors::Executor` or tokio's `Runtime` when building
the server.
+
+## Install
+
+```bash
+
+$ cargo add karyon_jsonrpc
+
+```
+
## Example
```rust
@@ -23,7 +32,7 @@ use smol::stream::StreamExt;
use karyon_jsonrpc::{
Error, Server, Client, rpc_impl, rpc_pubsub_impl, message::SubscriptionID,
- ArcChannel
+ Channel
};
struct HelloWorld {}
@@ -46,7 +55,7 @@ impl HelloWorld {
#[rpc_pubsub_impl]
impl HelloWorld {
- async fn log_subscribe(&self, chan: ArcChannel, method: String, _params: Value) -> Result<Value, Error> {
+ async fn log_subscribe(&self, chan: Arc<Channel>, method: String, _params: Value) -> Result<Value, Error> {
let sub = chan.new_subscription(&method).await;
let sub_id = sub.id.clone();
smol::spawn(async move {
@@ -63,7 +72,7 @@ impl HelloWorld {
Ok(serde_json::json!(sub_id))
}
- async fn log_unsubscribe(&self, chan: ArcChannel, method: String, params: Value) -> Result<Value, Error> {
+ async fn log_unsubscribe(&self, chan: Arc<Channel>, method: String, params: Value) -> Result<Value, Error> {
let sub_id: SubscriptionID = serde_json::from_value(params)?;
chan.remove_subscription(&sub_id).await;
Ok(serde_json::json!(true))
@@ -126,6 +135,10 @@ async {
```
+## Supported Client Implementations
+- [X] [Golang](https://github.com/karyontech/karyon-go)
+- [ ] Python
+- [ ] JavaScript/TypeScript