Crates.io | jsonrpc-ws-server |
lib.rs | jsonrpc-ws-server |
version | 18.0.0 |
source | src |
created_at | 2019-01-31 12:19:01.13157 |
updated_at | 2021-07-20 15:56:44.955168 |
description | WebSockets server for JSON-RPC |
homepage | https://github.com/paritytech/jsonrpc |
repository | https://github.com/paritytech/jsonrpc |
max_upload_size | |
id | 111785 |
size | 59,550 |
WebSockets server for JSON-RPC 2.0.
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()
}