17 stable releases (8 major)

✓ Uses Rust 2018 edition

new 14.0.0 Oct 9, 2019
13.2.0 Sep 13, 2019
13.1.0 Aug 26, 2019
13.0.0 Jul 29, 2019
6.0.0 Feb 16, 2017
Download history 407/week @ 2019-06-26 518/week @ 2019-07-03 573/week @ 2019-07-10 368/week @ 2019-07-17 366/week @ 2019-07-24 340/week @ 2019-07-31 306/week @ 2019-08-07 444/week @ 2019-08-14 657/week @ 2019-08-21 783/week @ 2019-08-28 726/week @ 2019-09-04 659/week @ 2019-09-11 694/week @ 2019-09-18 580/week @ 2019-09-25 594/week @ 2019-10-02

2,303 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

~5.5MB
~122K SLoC