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:
@@ -23,6 +23,7 @@ rustc-serialize = "0.3"
|
||||
transient-hashmap = "0.1"
|
||||
serde_macros = { version = "0.7.0", optional = true }
|
||||
clippy = { version = "0.0.64", optional = true}
|
||||
json-ipc-server = { git = "https://github.com/NikVolf/json-ipc-server.git" }
|
||||
|
||||
[build-dependencies]
|
||||
serde_codegen = { version = "0.7.0", optional = true }
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user