24 stable releases (8 major)

18.0.0 Jul 20, 2021
17.1.0 Jun 7, 2021
17.0.0 Jan 20, 2021
16.0.0 Dec 14, 2020
10.1.0 Feb 13, 2019

#15 in #json-rpc-server

Download history 2452/week @ 2024-06-14 2353/week @ 2024-06-21 1368/week @ 2024-06-28 712/week @ 2024-07-05 2279/week @ 2024-07-12 2852/week @ 2024-07-19 2458/week @ 2024-07-26 1728/week @ 2024-08-02 3704/week @ 2024-08-09 2378/week @ 2024-08-16 2391/week @ 2024-08-23 2367/week @ 2024-08-30 2016/week @ 2024-09-06 1820/week @ 2024-09-13 2392/week @ 2024-09-20 2017/week @ 2024-09-27

8,667 downloads per month
Used in 22 crates (6 directly)

MIT license

140KB
4K SLoC

jsonrpc-ws-server

WebSockets server for JSON-RPC 2.0.

Documentation

Example

Cargo.toml

[dependencies]
jsonrpc-ws-server = "15.0"

main.rs

use jsonrpc_ws_server::*;
use jsonrpc_ws_server::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

~11–22MB
~314K SLoC