diff options
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r-- | cmd/utils/cmd.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index a57d3266f..1d4655433 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -38,8 +38,10 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc" + rpchttp "github.com/ethereum/go-ethereum/rpc/http" + rpcws "github.com/ethereum/go-ethereum/rpc/ws" "github.com/ethereum/go-ethereum/state" + // "github.com/ethereum/go-ethereum/websocket" "github.com/ethereum/go-ethereum/xeth" ) @@ -192,7 +194,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre func StartRpc(ethereum *eth.Ethereum, RpcPort int) { var err error - ethereum.RpcServer, err = rpc.NewJsonRpcServer(xeth.NewJSXEth(ethereum), RpcPort) + ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.New(ethereum), RpcPort) if err != nil { clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else { @@ -200,6 +202,20 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) { } } +func StartWebSockets(eth *eth.Ethereum, wsPort int) { + clilogger.Infoln("Starting WebSockets") + + // sock := websocket.NewWebSocketServer(eth) + // go sock.Serv() + var err error + eth.WsServer, err = rpcws.NewWebSocketServer(eth, wsPort) + if err != nil { + clilogger.Errorf("Could not start RPC interface (port %v): %v", wsPort, err) + } else { + go eth.WsServer.Start() + } +} + var gminer *miner.Miner func GetMiner() *miner.Miner { |