Skip to content

Add GraphQL subscriptions for live prices #56

Description

@Miracle656

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
  1. Enable Mercurius subscriptions (subscription: true in options)
  2. Add a priceUpdated(pair) subscription resolver backed by app.graphql.pubsub
  3. Ingester publishes { pair, price, ts } after every new price
  4. Filter by pair in the resolver
  5. Write a small graphql-ws example client

Example commit message:
feat(graphql): add priceUpdated subscription via Mercurius

Acceptance criteria

  • Subscribing to priceUpdated(pair: "XLM/USDC") streams updates
  • Unsubscribing closes the channel cleanly
  • README documents the client snippet

Drips Wave · Complexity: Medium · 150 points
Comment below to request assignment. PR must include Closes #[this issue].

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions