aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/cmd.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r--cmd/utils/cmd.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index a57d3266f..70df289c3 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -38,7 +38,8 @@ 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/xeth"
)
@@ -120,9 +121,9 @@ func exit(err error) {
os.Exit(status)
}
-func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) {
+func StartEthereum(ethereum *eth.Ethereum, SeedNode string) {
clilogger.Infof("Starting %s", ethereum.ClientIdentity())
- err := ethereum.Start(UseSeed)
+ err := ethereum.Start(SeedNode)
if err != nil {
exit(err)
}
@@ -192,7 +193,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 +201,18 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
}
}
+func StartWebSockets(eth *eth.Ethereum, wsPort int) {
+ clilogger.Infoln("Starting WebSockets")
+
+ var err error
+ eth.WsServer, err = rpcws.NewWebSocketServer(xeth.New(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 {