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