Background
Mercurius already runs over the existing Fastify server; subscriptions are a small lift compared to building a separate WebSocket stack. Subscribing clients gets parity with the existing REST /ws channel via the familiar GraphQL idiom.
What to build
Add a priceUpdated(pair: String!) GraphQL subscription that emits whenever the ingester produces a new price.
Key files
lens/src/api/graphql.ts — register the subscription
lens/src/ingester/ — publish on new prices via Mercurius pubsub
- New: README example showing
graphql-ws client usage
Suggested execution
git checkout -b feat/graphql-subscriptions
- Enable Mercurius subscriptions (
subscription: true in options)
- Add a
priceUpdated(pair) subscription resolver backed by app.graphql.pubsub
- Ingester publishes
{ pair, price, ts } after every new price
- Filter by pair in the resolver
- Write a small
graphql-ws example client
Example commit message:
feat(graphql): add priceUpdated subscription via Mercurius
Acceptance criteria
Drips Wave · Complexity: Medium · 150 points
Comment below to request assignment. PR must include Closes #[this issue].
Background
Mercurius already runs over the existing Fastify server; subscriptions are a small lift compared to building a separate WebSocket stack. Subscribing clients gets parity with the existing REST
/wschannel via the familiar GraphQL idiom.What to build
Add a
priceUpdated(pair: String!)GraphQL subscription that emits whenever the ingester produces a new price.Key files
lens/src/api/graphql.ts— register the subscriptionlens/src/ingester/— publish on new prices via Mercurius pubsubgraphql-wsclient usageSuggested execution
subscription: truein options)priceUpdated(pair)subscription resolver backed byapp.graphql.pubsub{ pair, price, ts }after every new pricegraphql-wsexample clientExample commit message:
feat(graphql): add priceUpdated subscription via MercuriusAcceptance criteria
priceUpdated(pair: "XLM/USDC")streams updates