2 stable releases

10.1.0 Mar 24, 2019
10.0.1 Mar 25, 2019

#3 in #susy

Download history 22/week @ 2024-03-28 8/week @ 2024-04-04 82/week @ 2024-06-06 13/week @ 2024-06-13 2/week @ 2024-06-27 40/week @ 2024-07-04

58 downloads per month
Used in 3 crates

MIT license

120KB
3K SLoC

susy-jsonrpc-tcp-server

TCP server for JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies]
susy-jsonrpc-tcp-server = "10.0"

main.rs

use susy_jsonrpc_tcp_server::*;
use susy_jsonrpc_tcp_server::susy_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 susy_jsonrpc_core::*;
use susy_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

~11MB
~186K SLoC