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 795/week @ 2019-12-02 762/week @ 2019-12-09 708/week @ 2019-12-16 466/week @ 2019-12-23 522/week @ 2019-12-30 853/week @ 2020-01-06 1021/week @ 2020-01-13 592/week @ 2020-01-20 627/week @ 2020-01-27 512/week @ 2020-02-03 726/week @ 2020-02-10 707/week @ 2020-02-17 720/week @ 2020-02-24 828/week @ 2020-03-02 1034/week @ 2020-03-09 1180/week @ 2020-03-16

2,959 downloads per month
Used in 4 crates

MIT license

125KB
3.5K SLoC

Razor 1.5K SLoC // 0.1% comments Rust 1.5K SLoC // 0.1% comments

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
~135K SLoC