You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title:feat: implement GraphQL subscription support for real-time event streaming
Labels:enhancementfeatureapi Complexity:high Branch:feat/graphql-subscriptions Depends on: Issue #11
Problem Context
Issue #11 added raw WebSocket subscriptions at ws://host/ws/events/<contract_id>/. However, clients using Apollo Client or other GraphQL clients expect a typed subscription operation over the standard graphql-ws protocol — not a custom JSON wire format. This issue upgrades the real-time layer to first-class GraphQL subscriptions using Strawberry's AsyncGenerator subscription API over Django Channels.
Scope
Included:
Strawberry @strawberry.subscription resolver for contractEvents(contractId: String!)
graphql-ws protocol support via Strawberry's Channels integration
Title:
feat: implement GraphQL subscription support for real-time event streamingLabels:
enhancementfeatureapiComplexity:
highBranch:
feat/graphql-subscriptionsDepends on: Issue #11
Problem Context
Issue #11 added raw WebSocket subscriptions at
ws://host/ws/events/<contract_id>/. However, clients using Apollo Client or other GraphQL clients expect a typedsubscriptionoperation over the standardgraphql-wsprotocol — not a custom JSON wire format. This issue upgrades the real-time layer to first-class GraphQL subscriptions using Strawberry'sAsyncGeneratorsubscription API over Django Channels.Scope
Included:
@strawberry.subscriptionresolver forcontractEvents(contractId: String!)graphql-wsprotocol support via Strawberry's Channels integrationNot included:
contractId(Phase 2)Implementation Guidelines
Files to update:
django-backend/soroscan/ingest/schema.py— addSubscriptiontype withcontract_eventsresolverdjango-backend/soroscan/asgi.py— mount StrawberryGraphqlWsConsumerat/graphql/django-backend/soroscan/ingest/tasks.py— publish to channel group after event persist (already done in Add real-time WebSocket event subscriptions using Django Channels #11, reuse)django-backend/requirements.txt— ensurestrawberry-graphql[channels]is installedSubscription resolver:
ASGI routing update:
Constraints:
/graphql/AsyncGenerator— notIterator— to avoid blocking the event loopAcceptance Criteria
subscription { contractEvents(contractId: "X") { id eventType timestamp } }works overgraphql-wsuseSubscriptionhook connects and receives events