Merge pull request #31 from filecoin-project/feat/wsrpc

JsonRPC over WebSockets
This commit is contained in:
Whyrusleeping
2019-07-16 09:36:32 -07:00
committed by GitHub
11 changed files with 516 additions and 221 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ func getAPI(ctx *cli.Context) (api.API, error) {
if err != nil {
return nil, err
}
return client.NewRPC("http://" + addr + "/rpc/v0"), nil
return client.NewRPC("ws://" + addr + "/rpc/v0")
}
// reqContext returns context for cli execution. Calling it for the first time
+11 -2
View File
@@ -1,16 +1,25 @@
package cli
import (
"fmt"
"gopkg.in/urfave/cli.v2"
)
var versionCmd = &cli.Command{
Name: "version",
Usage: "Print version",
Action: func(context *cli.Context) error {
Action: func(cctx *cli.Context) error {
api, err := getAPI(cctx)
if err != nil {
return err
}
ctx := reqContext(cctx)
// TODO: print more useful things
cli.VersionPrinter(context)
fmt.Println(api.Version(ctx))
cli.VersionPrinter(cctx)
return nil
},
}