22 stable releases (8 major)

✓ Uses Rust 2018 edition

14.0.6 Feb 7, 2020
14.0.5 Nov 28, 2019
14.0.3 Oct 25, 2019
13.2.0 Sep 13, 2019
6.0.0 Feb 16, 2017
Download history 646/week @ 2019-11-07 776/week @ 2019-11-14 686/week @ 2019-11-21 621/week @ 2019-11-28 855/week @ 2019-12-05 795/week @ 2019-12-12 525/week @ 2019-12-19 470/week @ 2019-12-26 770/week @ 2020-01-02 1109/week @ 2020-01-09 692/week @ 2020-01-16 500/week @ 2020-01-23 554/week @ 2020-01-30 607/week @ 2020-02-06 685/week @ 2020-02-13

2,959 downloads per month
Used in 4 crates

MIT license

125KB
3.5K SLoC

jsonrpc-tcp-server

TCP server for JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies]
jsonrpc-tcp-server = "14.0"

main.rs

use jsonrpc_tcp_server::*;
use jsonrpc_tcp_server::jsonrpc_core::*;

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

	let server = ServerBuilder::new(io)
		.start(&"0.0.0.0:3030".parse().unwrap())
		.expect("Server must start with no issues");

	server.wait().unwrap()
}

lib.rs:

jsonrpc server over tcp/ip

use jsonrpc_core::*;
use jsonrpc_tcp_server::ServerBuilder;

fn main() {
	let mut io = IoHandler::default();
	io.add_method("say_hello", |_params| {
		Ok(Value::String("hello".to_string()))
	});
	let server = ServerBuilder::new(io)
   		.start(&"0.0.0.0:0".parse().unwrap())
   		.expect("Server must start with no issues.");

   	server.wait();
}

Dependencies

~6.5MB
~134K SLoC