add websocket rpc server
This commit is contained in:
parent
5e87624315
commit
77092641b5
|
@ -788,7 +788,7 @@ LOCAL SERVICE OPTIONS:
|
|||
--graphql Enable the HTTP-GraphQL server
|
||||
--graphqlbind:<value> Set address:port pair GraphQL server will bind (default: localhost:8547)
|
||||
--ws Enable the Websocket JSON-RPC server
|
||||
--wsbind:<value> Set address:port pair(s) (comma-separated) Websocket JSON-RPC server will bind to (default: localhost:8546)
|
||||
--wsbind:<value> Set address:port pair Websocket JSON-RPC server will bind to (default: localhost:8546)
|
||||
--wsapi:<value> Enable specific set of Websocket RPC API from list (comma-separated) (available: eth, debug)
|
||||
|
||||
LOGGING AND DEBUGGING OPTIONS:
|
||||
|
|
|
@ -40,6 +40,7 @@ type
|
|||
ethNode*: EthereumNode
|
||||
state*: NimbusState
|
||||
graphqlServer*: GraphqlHttpServerRef
|
||||
wsRpcServer*: RpcWebSocketServer
|
||||
|
||||
proc start(nimbus: NimbusNode) =
|
||||
var conf = getConfiguration()
|
||||
|
@ -138,6 +139,18 @@ proc start(nimbus: NimbusNode) =
|
|||
if RpcFlags.Debug in conf.rpc.flags:
|
||||
setupDebugRpc(chainDB, nimbus.rpcServer)
|
||||
|
||||
# Creating Websocket RPC Server
|
||||
if RpcFlags.Enabled in conf.ws.flags:
|
||||
doAssert(conf.ws.binds.len > 0)
|
||||
nimbus.wsRpcServer = newRpcWebSocketServer(conf.ws.binds[0])
|
||||
setupCommonRpc(nimbus.ethNode, nimbus.wsRpcServer)
|
||||
|
||||
# Enable Websocket RPC APIs based on RPC flags and protocol flags
|
||||
if RpcFlags.Eth in conf.ws.flags and ProtocolFlags.Eth in conf.net.protocols:
|
||||
setupEthRpc(nimbus.ethNode, chainDB, nimbus.wsRpcServer)
|
||||
if RpcFlags.Debug in conf.ws.flags:
|
||||
setupDebugRpc(chainDB, nimbus.wsRpcServer)
|
||||
|
||||
## Starting servers
|
||||
if RpcFlags.Enabled in conf.rpc.flags:
|
||||
nimbus.rpcServer.rpc("admin_quit") do() -> string:
|
||||
|
|
Loading…
Reference in New Issue