graph-node
graph-node copied to clipboard
Q: Graph-node subscriptions
Q: Is there any way to subscribe (e.g via websocket) for event (eth contract's event) which is handled in subgraph/graph-node?
-
Let's say we have following event defined in subgraph.yaml under eventhandlers.event: - event: Transfer(indexed address,indexed address,indexed uint256) handler: handleTransfer
-
Such event ( Transfer(indexed address,indexed address,indexed uint256) ) is also defined in contract's ABI (and so it is published by eth network).
Is there any way to subscribe for it directly via graph-node, so that every transfer which results in saving some data/entity in graph-node and which we may query for will be immediately published? Or does this kind of publishing logic has to be included in the event handler? (or as I understood its subgraph which shall define type Subscription in its schema.graphql, so we may then listen for it through graph-node, yes?)
I would like to not have to make any kind of polling and get real-time data from the graph-node when it does save data/entities.
Is there any example/doc regarding how we may subscribe through GRAPH-QL-WS? I've managed to connect to graphql-ws for one of the subgraphs but I did not manage to subscribe for anything.
I'll close it as there's no activity.
Same here, may be websocket is not implement.
Hello, is there any documentation for the above one? Cause i would like to use graphql subscriptions to subscribe to entities changes when events are emitted and handlers modify entities, instead of using graphql polling