#json-rpc #server #tetsy

tetsy-jsonrpc-ws-server

Tetsy WebSockets server for JSON-RPC

Show the crate…

3 stable releases

15.1.0 Mar 13, 2021
14.2.1 Mar 1, 2021

#19 in #tetsy

25 downloads per month
Used in 25 crates (2 directly)

MIT license

140KB
4K SLoC

tetsy-jsonrpc-ws-server

WebSockets server for JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies]
tetsy-jsonrpc-ws-server = "14.2"

main.rs

use tetsy_jsonrpc_ws_server::*;
use tetsy_jsonrpc_ws_server::tetsy_jsonrpc_core::*;

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

	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:

WebSockets server.

Dependencies

~15MB
~256K SLoC