diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-29 01:22:53 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-29 01:22:53 +0800 |
commit | 45e15f62f594d6f5191e60a54aead33602838e98 (patch) | |
tree | 5b82273df6a23c219d1e97dbb86b4bdcb620374a /cmd/utils/cmd.go | |
parent | fb7c03ff4dc759f7dd2fc5cee65b46111cbb7375 (diff) | |
parent | 7f638f0b2d8d989be25e660178d79df3278e4c84 (diff) | |
download | go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar.gz go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar.bz2 go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar.lz go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar.xz go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.tar.zst go-tangerine-45e15f62f594d6f5191e60a54aead33602838e98.zip |
merge jsonrpc
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r-- | cmd/utils/cmd.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 95a7f89c8..9cdd8b5d1 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -38,9 +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/websocket" "github.com/ethereum/go-ethereum/xeth" ) @@ -193,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.NewJSXEth(ethereum), RpcPort) if err != nil { clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err) } else { @@ -201,11 +202,18 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) { } } -func StartWebSockets(eth *eth.Ethereum) { +func StartWebSockets(eth *eth.Ethereum, wsPort int) { clilogger.Infoln("Starting WebSockets") - sock := websocket.NewWebSocketServer(eth) - go sock.Serv() + // 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 |