diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-28 02:28:58 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-28 02:29:08 +0800 |
commit | 5f50fe7a4a6218bedf78333d751b57166932464a (patch) | |
tree | 57c57b0731666f883069cd15fe155c1e2ea4f558 /cmd/utils/cmd.go | |
parent | b8e7b8e2e1b88e40090c9b741b4cd7000689ae9e (diff) | |
download | go-tangerine-5f50fe7a4a6218bedf78333d751b57166932464a.tar.gz go-tangerine-5f50fe7a4a6218bedf78333d751b57166932464a.tar.zst go-tangerine-5f50fe7a4a6218bedf78333d751b57166932464a.zip |
Update CLI to use new Websocket RPC
Use “wsport” flag to change default port
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r-- | cmd/utils/cmd.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 13fbc7c64..437e0c037 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -39,8 +39,9 @@ import ( "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/rlp" rpchttp "github.com/ethereum/go-ethereum/rpc/http" + rpcws "github.com/ethereum/go-ethereum/rpc/websocket" "github.com/ethereum/go-ethereum/state" - "github.com/ethereum/go-ethereum/websocket" + // "github.com/ethereum/go-ethereum/websocket" "github.com/ethereum/go-ethereum/xeth" ) @@ -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 |