3 stable releases

11.0.0 Apr 13, 2019
10.1.0 Apr 13, 2019
10.0.1 Mar 25, 2019

#5 in #server-builder

Download history 8/week @ 2024-03-12 4/week @ 2024-03-26 45/week @ 2024-04-02 1/week @ 2024-05-28 2/week @ 2024-06-04 142/week @ 2024-06-11

144 downloads per month
Used in 3 crates

MIT license

120KB
3K SLoC

susydev-jsonrpc-tcp-server

TCP server for JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies]
susydev-jsonrpc-tcp-server = "11.0"

main.rs

use susydev_jsonrpc_tcp_server::*;
use susydev_jsonrpc_tcp_server::susydev_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 susydev_jsonrpc_core::*;
use susydev_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