Crate jsonrpc_http_server[][src]

Expand description

jsonrpc http server.

use jsonrpc_core::*;
use jsonrpc_http_server::*;

fn main() {
    let mut io = IoHandler::new();
    io.add_sync_method("say_hello", |_: Params| {

    let _server = ServerBuilder::new(io)
    .expect("Unable to start RPC server");



pub use hyper;
pub use jsonrpc_core;
pub use crate::server_utils::tokio;


CORS handling utility functions


Handle used to close the server. Can be cloned and passed around to different threads and be used to close a server that is wait()ing.

Host type

Request Origin

Simple server response structure

RPC Handler bundled with metadata extractor.

jsonrpc http server instance

Convenient JSON-RPC HTTP Server builder.

jsonrpc http request handler.

Incoming is a stream of incoming sockets Polling the stream may return a temporary io::Error (for instance if we can’t open the connection because of “too many open files” limit) we use for_each combinator which:

A weak handle to the RPC server.


Origins allowed to access

CORS response headers

Specifies if domains should be validated.

Action undertaken by a middleware.

REST -> RPC converter state.


Extracts metadata from the HTTP request.

Allows to intercept request and handle it differently.


Returns the CORS AllowHeaders header that should be returned with that request.

Returns a CORS AllowOrigin header that should be returned with that request.

Returns true if Host header in request matches a list of allowed hosts.

Type Definitions

Task executor for Tokio 0.2 runtime.