Expand description

jsonrpc http server.

extern crate jsonrpc_core;
extern crate jsonrpc_http_server;

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

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

	let _server = ServerBuilder::new(io)
	.start_http(&"127.0.0.1:3030".parse().unwrap())
	.expect("Unable to start RPC server");

_server.wait();
}

Re-exports

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

Modules

CORS handling utility functions

Structs

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:

Enums

Origins allowed to access
CORS response headers
Specifies if domains should be validated.
Action undertaken by a middleware.
REST -> RPC converter state.

Traits

Extracts metadata from the HTTP request.
Allows to intercept request and handle it differently.

Functions

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.