Crates.io | jsonrpc-tcp-server |
lib.rs | jsonrpc-tcp-server |
version | 18.0.0 |
source | src |
created_at | 2017-02-16 13:49:05.880087 |
updated_at | 2021-07-20 15:56:19.721217 |
description | TCP/IP server for JSON-RPC |
homepage | https://github.com/paritytech/jsonrpc |
repository | https://github.com/paritytech/jsonrpc |
max_upload_size | |
id | 8539 |
size | 40,893 |
TCP server for JSON-RPC 2.0.
Cargo.toml
[dependencies]
jsonrpc-tcp-server = "15.0"
main.rs
use jsonrpc_tcp_server::*;
use jsonrpc_tcp_server::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()
}