Browse Source

docs: add client.Start() to RPC WS examples (#2936)

pull/2939/head
Daniil Lashin 6 years ago
committed by Anton Kaliaev
parent
commit
9adcfe2804
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      rpc/core/events.go

+ 6
- 3
rpc/core/events.go View File

@ -54,11 +54,12 @@ import (
// import "github.com/tendermint/tendermint/types"
//
// client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
// err := client.Start()
// ctx, cancel := context.WithTimeout(context.Background(), timeout)
// defer cancel()
// query := query.MustParse("tm.event = 'Tx' AND tx.height = 3")
// txs := make(chan interface{})
// err := client.Subscribe(ctx, "test-client", query, txs)
// err = client.Subscribe(ctx, "test-client", query, txs)
//
// go func() {
// for e := range txs {
@ -116,7 +117,8 @@ func Subscribe(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultSubscri
//
// ```go
// client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
// err := client.Unsubscribe("test-client", query)
// err := client.Start()
// err = client.Unsubscribe("test-client", query)
// ```
//
// > The above command returns JSON structured like this:
@ -155,7 +157,8 @@ func Unsubscribe(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultUnsub
//
// ```go
// client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
// err := client.UnsubscribeAll("test-client")
// err := client.Start()
// err = client.UnsubscribeAll("test-client")
// ```
//
// > The above command returns JSON structured like this:


Loading…
Cancel
Save