{"id":13746392,"url":"https://github.com/paritytech/jsonrpc","last_synced_at":"2025-05-14T02:05:55.649Z","repository":{"id":37686800,"uuid":"74377848","full_name":"paritytech/jsonrpc","owner":"paritytech","description":"Rust JSON-RPC implementation","archived":false,"fork":false,"pushed_at":"2024-08-21T13:38:57.000Z","size":3338,"stargazers_count":807,"open_issues_count":86,"forks_count":273,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-05-08T00:13:00.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paritytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-21T15:32:15.000Z","updated_at":"2025-05-03T04:28:49.000Z","dependencies_parsed_at":"2024-01-18T04:08:46.985Z","dependency_job_id":"ec1ca176-69d2-4f68-980e-edb8b0f85588","html_url":"https://github.com/paritytech/jsonrpc","commit_stats":{"total_commits":658,"total_committers":81,"mean_commits":8.123456790123457,"dds":0.8100303951367781,"last_synced_commit":"38af3c9439aa75481805edf6c05c6622a5ab1e70"},"previous_names":[],"tags_count":157,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fjsonrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fjsonrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fjsonrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritytech%2Fjsonrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paritytech","download_url":"https://codeload.github.com/paritytech/jsonrpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052692,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T06:00:52.918Z","updated_at":"2025-05-14T02:05:50.634Z","avatar_url":"https://github.com/paritytech.png","language":"Rust","funding_links":[],"categories":["Rust","Smart Contract Platforms"],"sub_categories":[],"readme":"# Parity JSON-RPC\n\n**NOTE: This crate is no longer actively developed; please have a look at our \n[jsonrpsee](https://github.com/paritytech/jsonrpsee) crate if you're looking for an actively \nmaintained JSON RPC implementation.**\n\nRust implementation of JSON-RPC 2.0 Specification.\nTransport-agnostic `core` and transport servers for `http`, `ipc`, `websockets` and `tcp`.\n\n**New!** Support for [clients](#Client-support).\n\n[Documentation](https://docs.rs/jsonrpc-core/)\n\n## Sub-projects\n- [jsonrpc-core](./core) [![crates.io][core-image]][core-url]\n- [jsonrpc-core-client](./core-client) [![crates.io][core-client-image]][core-client-url]\n- [jsonrpc-http-server](./http) [![crates.io][http-server-image]][http-server-url]\n- [jsonrpc-ipc-server](./ipc) [![crates.io][ipc-server-image]][ipc-server-url]\n- [jsonrpc-tcp-server](./tcp) [![crates.io][tcp-server-image]][tcp-server-url]\n- [jsonrpc-ws-server](./ws) [![crates.io][ws-server-image]][ws-server-url]\n- [jsonrpc-stdio-server](./stdio) [![crates.io][stdio-server-image]][stdio-server-url]\n- [jsonrpc-derive](./derive) [![crates.io][derive-image]][derive-url]\n- [jsonrpc-server-utils](./server-utils) [![crates.io][server-utils-image]][server-utils-url]\n- [jsonrpc-pubsub](./pubsub) [![crates.io][pubsub-image]][pubsub-url]\n\n[core-image]: https://img.shields.io/crates/v/jsonrpc-core.svg\n[core-url]: https://crates.io/crates/jsonrpc-core\n[core-client-image]: https://img.shields.io/crates/v/jsonrpc-core-client.svg\n[core-client-url]: https://crates.io/crates/jsonrpc-core-client\n[http-server-image]: https://img.shields.io/crates/v/jsonrpc-http-server.svg\n[http-server-url]: https://crates.io/crates/jsonrpc-http-server\n[ipc-server-image]: https://img.shields.io/crates/v/jsonrpc-ipc-server.svg\n[ipc-server-url]: https://crates.io/crates/jsonrpc-ipc-server\n[tcp-server-image]: https://img.shields.io/crates/v/jsonrpc-tcp-server.svg\n[tcp-server-url]: https://crates.io/crates/jsonrpc-tcp-server\n[ws-server-image]: https://img.shields.io/crates/v/jsonrpc-ws-server.svg\n[ws-server-url]: https://crates.io/crates/jsonrpc-ws-server\n[stdio-server-image]: https://img.shields.io/crates/v/jsonrpc-stdio-server.svg\n[stdio-server-url]: https://crates.io/crates/jsonrpc-stdio-server\n[derive-image]: https://img.shields.io/crates/v/jsonrpc-derive.svg\n[derive-url]: https://crates.io/crates/jsonrpc-derive\n[server-utils-image]: https://img.shields.io/crates/v/jsonrpc-server-utils.svg\n[server-utils-url]: https://crates.io/crates/jsonrpc-server-utils\n[pubsub-image]: https://img.shields.io/crates/v/jsonrpc-pubsub.svg\n[pubsub-url]: https://crates.io/crates/jsonrpc-pubsub\n\n## Examples\n\n- [core](./core/examples)\n- [derive](./derive/examples)\n- [pubsub](./pubsub/examples)\n\n### Basic Usage (with HTTP transport)\n\n```rust\nuse jsonrpc_http_server::jsonrpc_core::{IoHandler, Value, Params};\nuse jsonrpc_http_server::ServerBuilder;\n\nfn main() {\n\tlet mut io = IoHandler::default();\n\tio.add_method(\"say_hello\", |_params: Params| async {\n\t\tOk(Value::String(\"hello\".to_owned()))\n\t});\n\n\tlet server = ServerBuilder::new(io)\n\t\t.threads(3)\n\t\t.start_http(\u0026\"127.0.0.1:3030\".parse().unwrap())\n\t\t.unwrap();\n\n\tserver.wait();\n}\n```\n\n### Basic usage with derive\n\n```rust\nuse jsonrpc_core::Result;\nuse jsonrpc_derive::rpc;\n\n#[rpc]\npub trait Rpc {\n\t/// Adds two numbers and returns a result\n\t#[rpc(name = \"add\")]\n\tfn add(\u0026self, a: u64, b: u64) -\u003e Result\u003cu64\u003e;\n}\n\npub struct RpcImpl;\nimpl Rpc for RpcImpl {\n\tfn add(\u0026self, a: u64, b: u64) -\u003e Result\u003cu64\u003e {\n\t\tOk(a + b)\n\t}\n}\n\nfn main() {\n\tlet mut io = jsonrpc_core::IoHandler::new();\n\tio.extend_with(RpcImpl.to_delegate())\n}\n```\n\n### Client support\n\n```rust\nuse jsonrpc_core_client::transports::local;\nuse jsonrpc_core::{BoxFuture, IoHandler, Result};\nuse jsonrpc_core::futures::{self, future, TryFutureExt};\nuse jsonrpc_derive::rpc;\n\n/// Rpc trait\n#[rpc]\npub trait Rpc {\n\t/// Returns a protocol version\n\t#[rpc(name = \"protocolVersion\")]\n\tfn protocol_version(\u0026self) -\u003e Result\u003cString\u003e;\n\n\t/// Adds two numbers and returns a result\n\t#[rpc(name = \"add\", alias(\"callAsyncMetaAlias\"))]\n\tfn add(\u0026self, a: u64, b: u64) -\u003e Result\u003cu64\u003e;\n\n\t/// Performs asynchronous operation\n\t#[rpc(name = \"callAsync\")]\n\tfn call(\u0026self, a: u64) -\u003e BoxFuture\u003cResult\u003cString\u003e\u003e;\n}\n\nstruct RpcImpl;\n\nimpl Rpc for RpcImpl {\n\tfn protocol_version(\u0026self) -\u003e Result\u003cString\u003e {\n\t\tOk(\"version1\".into())\n\t}\n\n\tfn add(\u0026self, a: u64, b: u64) -\u003e Result\u003cu64\u003e {\n\t\tOk(a + b)\n\t}\n\n\tfn call(\u0026self, _: u64) -\u003e BoxFuture\u003cResult\u003cString\u003e\u003e {\n\t\tBox::pin(future::ready(Ok(\"OK\".to_owned())))\n\t}\n}\n\nfn main() {\n\tlet mut io = IoHandler::new();\n\tio.extend_with(RpcImpl.to_delegate());\n\n\tlet (client, server) = local::connect::\u003cgen_client::Client, _, _\u003e(io);\n\tlet fut = client.add(5, 6).map_ok(|res| println!(\"5 + 6 = {}\", res));\n\tfutures::executor::block_on(async move { futures::join!(fut, server) })\n\t\t.0\n\t\t.unwrap();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fjsonrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparitytech%2Fjsonrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitytech%2Fjsonrpc/lists"}