1 unstable release

0.1.0 Nov 5, 2018
Download history 5/week @ 2018-11-05 9/week @ 2018-11-12 4/week @ 2018-11-19 2/week @ 2018-11-26 8/week @ 2018-12-03 5/week @ 2018-12-10 1/week @ 2018-12-17 7/week @ 2018-12-24

1 downloads per month

MIT license

52KB
1K SLoC

jsonrpc-stdio-server

STDIN/STDOUT server for JSON-RPC 2.0. Takes one request per line and outputs each response on a new line.

Documentation

Example

Cargo.toml

[dependencies]
jsonrpc-stdio-server = { git = "https://github.com/paritytech/jsonrpc" }

main.rs

extern crate jsonrpc_stdio_server;

use jsonrpc_stdio_server::server;
use jsonrpc_stdio_server::jsonrpc_core::*;

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

	ServerBuilder::new(io).build();
}

lib.rs:

jsonrpc server using stdin/stdout

extern crate jsonrpc_stdio_server;

use jsonrpc_stdio_server::ServerBuilder;
use jsonrpc_stdio_server::jsonrpc_core::*;

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

	ServerBuilder::new(io).build();
}

Dependencies

~5.5MB
~100K SLoC