This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Handle jsonrpc-core IOHandler stuff in actix | |
/// Based on https://github.com/paritytech/jsonrpc/blob/9360dc86e9c02e65e858ee7816c5ce6e04f18aef/http/src/handler.rs#L415 | |
fn jsonrpc_websocket_bridge( | |
(data, req): (web::Json<Request>, web::Data<JsonrpcState>), | |
) -> impl Future<Item = HttpResponse, Error = WebError> { | |
req.handle_rpc_request(data.into_inner()) | |
.map(|res| match res { | |
Some(v) => HttpResponse::Ok().json(v), | |
e => { | |
error!("Invalid response for request: {:?}", e); |