JSON-RPC over IPC (#1039)

* moving namespaces for http/rpc

* cli options for ipc

* jsonrpc exposed fully

* updating json-ipc-server & removing non-standart traces api from defaults

* spelling & format
This commit is contained in:
Nikolay Volf
2016-05-04 16:37:09 +03:00
committed by Gav Wood
parent 58fd0175bf
commit c449bf5663
8 changed files with 102 additions and 27 deletions

View File

@@ -31,6 +31,7 @@ extern crate ethcore;
extern crate ethsync;
extern crate ethminer;
extern crate transient_hashmap;
extern crate json_ipc_server as ipc;
use std::sync::Arc;
use std::net::SocketAddr;
@@ -41,7 +42,7 @@ pub mod v1;
/// Http server.
pub struct RpcServer {
handler: Arc<IoHandler>,
handler: Arc<jsonrpc_core::io::IoHandler>,
}
impl RpcServer {
@@ -62,4 +63,11 @@ impl RpcServer {
let cors_domain = cors_domain.to_owned();
Server::start(addr, self.handler.clone(), cors_domain.map(jsonrpc_http_server::AccessControlAllowOrigin::Value))
}
/// Start ipc server asynchronously and returns result with `Server` handle on success or an error.
pub fn start_ipc(&self, addr: &str) -> Result<ipc::Server, ipc::Error> {
let server = try!(ipc::Server::new(addr, &self.handler));
try!(server.run_async());
Ok(server)
}
}