Subscribe Collections
Subscribe to blockchain events
You can create a websocket subscription for any event in the blockchain.
Read filter syntax and collections documentation in the previous section.
In this example, we start a subscription and get a result whenever a new block is generated.
subscription {
blocks {
id
}
}The filter and result parameters are the same as in the query method. The filter parameter narrows the action down to a subset of monitored items. In this case, the filter is empty: all items are included into monitoring.
wscat -c your-wss-endpoint -s graphql-ws
{"id":"1","type":"start","payload":{"variables":{},"extensions":{},"operationName":null,"query":"subscription{\n blocks(filter:{\n workchain_id:{\n eq:-1\n }\n }){\n seq_no\n id\n }\n}"}}Last updated
Was this helpful?