You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Thomas Kerber 2f0b68ea48
Add stuff to patch around carnix bug.
1 year ago
core Bump version. (#223) 1 year ago
http Introduce error_chain (#215) 1 year ago
ipc Remove boxing and allow IntoFuture (#199) 1 year ago
macros Introduce error_chain (#215) 1 year ago
minihttp Introduce error_chain (#215) 1 year ago
pubsub Introduce error_chain (#215) 1 year ago
server-utils Remove boxing and allow IntoFuture (#199) 1 year ago
tcp Add documentation link and license for jsonrpc-test (#218) 1 year ago
test Add documentation link and license for jsonrpc-test (#218) 1 year ago
ws Introduce error_chain (#215) 1 year ago
.editorconfig tabify & prettify 2 years ago
.gitignore Merge remote-tracking branch 'tcp/master' 2 years ago
.travis.yml virtual workspace, updated .travis.yml, cargo files and README.md (#186) 2 years ago
Cargo.toml Add stuff to patch around carnix bug. 1 year ago
LICENSE add LICENSE, closes #98 (#99) 2 years ago
README.md Introduce error_chain (#215) 1 year ago

README.md

Parity JSON-RPC

Rust implementation of JSON-RPC 2.0 Specification. Transport-agnostic core and transport servers for http, ipc, websockets and tcp.

Build Status

Documentation

Sub-projects

Examples

Basic Usage (with HTTP transport)

extern crate jsonrpc_core;
extern crate jsonrpc_minihttp_server;

use jsonrpc_core::{IoHandler, Value, Params};
use jsonrpc_minihttp_server::{ServerBuilder};

fn main() {
	let mut io = IoHandler::new();
	io.add_method("say_hello", |_params: Params| {
		Ok(Value::String("hello".to_string()))
	});

	let server = ServerBuilder::new(io)
		.threads(3)
		.start_http(&"127.0.0.1:3030".parse().unwrap())
		.unwrap();

	server.wait().unwrap();
}

Basic usage with macros

```rust extern crate jsonrpc_core;

[macro_use]

extern crate jsonrpc_macros;

use jsonrpc_core::Result;

build_rpc_trait! {

pub trait Rpc {
    /// Adds two numbers and returns a result
    #[rpc(name = "add")]
    fn add(&self, u64, u64) -> Result<u64>;
}

}

pub struct RpcImpl; impl Rpc for RpcImpl {

fn add(&self, a: u64, b: u64) -> Result<u64> {
    Ok(a + b)
}

}

fn main() {

let mut io = jsonrpc_core::IoHandler::new();
io.extend_with(RpcImpl.to_delegate())

}