Skip to content

Example in docs on Websocket RPC Subscribe #3678

@folex

Description

@folex

Tendermint version: 0.30.2

Environment:

  • OS: macOS 10.14.4
  • Install tools: docker

Have you tried the latest version: no

I'm trying to run example from https://tendermint.com/rpc/#subscribe , but I'm not sure if I'm using correct imports. In doc, there is a client, but no import, and I use rpc/client:

rpcclient "github.com/tendermint/tendermint/rpc/client"
client := rpcclient.NewHTTP(...)
ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
query := "tm.event = 'Tx' AND tx.height = 3"
resultCh, err := client.Subscribe(ctx, "test-client", query, 1)

I had to tweak the code a bit (query is string, not Query, txs => resultCh), and now I'm stuck with SIGSEGV.

Minified stack trace:

panic SIGSEGV
rpc/lib/client.(*WSClient).Call(0x0, ...) ws_client.go:217
rpc/lib/client.(*WSClient).Subscribe(0x0, ...) ws_client.go:485
rpc/client.(*WSEvents).Subscribe(...) httpclient.go:309
test

P.S. Also, there's shell example missing. I could contribute it, but it will require usage of websocat. Would you accept such an example? It could look like this:

# installation info: https://github.com/vi/websocat
websocat -t --jsonrpc ws://localhost:26657/websocket
subscribe "tm.event = 'Tx'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:docsComponent: DocumentationC:rpcComponent: JSON RPC, gRPCS:waitingStatus: Waiting for response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions