github.com/number571/tendermint@v0.34.11-gost/docs/tendermint-core/subscription.md (about) 1 --- 2 order: 7 3 --- 4 5 # Subscribing to events via Websocket 6 7 Tendermint emits different events, which you can subscribe to via 8 [Websocket](https://en.wikipedia.org/wiki/WebSocket). This can be useful 9 for third-party applications (for analysis) or for inspecting state. 10 11 [List of events](https://godoc.org/github.com/number571/tendermint/types#pkg-constants) 12 13 To connect to a node via websocket from the CLI, you can use a tool such as 14 [wscat](https://github.com/websockets/wscat) and run: 15 16 ```sh 17 wscat ws://127.0.0.1:26657/websocket 18 ``` 19 20 You can subscribe to any of the events above by calling the `subscribe` RPC 21 method via Websocket along with a valid query. 22 23 ```json 24 { 25 "jsonrpc": "2.0", 26 "method": "subscribe", 27 "id": 0, 28 "params": { 29 "query": "tm.event='NewBlock'" 30 } 31 } 32 ``` 33 34 Check out [API docs](https://docs.tendermint.com/master/rpc/) for 35 more information on query syntax and other options. 36 37 You can also use tags, given you had included them into DeliverTx 38 response, to query transaction results. See [Indexing 39 transactions](../app-dev/indexing-transactions.md) for details. 40 41 ## ValidatorSetUpdates 42 43 When validator set changes, ValidatorSetUpdates event is published. The 44 event carries a list of pubkey/power pairs. The list is the same 45 Tendermint receives from ABCI application (see [EndBlock 46 section](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md#endblock) in 47 the ABCI spec). 48 49 Response: 50 51 ```json 52 { 53 "jsonrpc": "2.0", 54 "id": 0, 55 "result": { 56 "query": "tm.event='ValidatorSetUpdates'", 57 "data": { 58 "type": "tendermint/event/ValidatorSetUpdates", 59 "value": { 60 "validator_updates": [ 61 { 62 "address": "09EAD022FD25DE3A02E64B0FE9610B1417183EE4", 63 "pub_key": { 64 "type": "tendermint/PubKeyEd25519", 65 "value": "ww0z4WaZ0Xg+YI10w43wTWbBmM3dpVza4mmSQYsd0ck=" 66 }, 67 "voting_power": "10", 68 "proposer_priority": "0" 69 } 70 ] 71 } 72 } 73 } 74 } 75 ```