Cosmo Streams | WunderGraph Cosmo - WunderGraph
GraphQL Subscriptions Without the Hurdle
Cosmo Streams moves subscription infrastructure into the Router, so your services only publish events and respond to HTTP requests. No connection management required.
The Problem
Subscriptions force connection state into every service.
Without Cosmo Streams, each service that supports subscriptions manages its own connection state, WebSocket servers, and subscriber tracking. Scaling and infrastructure choices become constrained by persistent connections.
01
Connection state in every service
Each service manages WebSocket servers, subscriber tracking, and persistent state. The Router does not own connections.
02
Scaling tied to subscribers
Subscriber count influences how services scale. As connections grow, every participating service must account for the persistent load.
03
Infrastructure limits
Persistent connections limit infrastructure choices. Many compute platforms aren't designed to maintain long-lived connections.
How It Works
The Router runs the subscription server. Your services stay HTTP-only.
01
Service publishes an event
A service publishes an event when data changes. No WebSocket server required.
02
Router receives the event
The Router receives the event from Kafka, NATS, or Redis.
03
Router resolves fields
The Router resolves additional fields; events may carry base data.
04
Deliver to subscribers
The Router delivers the result to matching subscribers.
Capabilities
Subscriptions without connection management in your services
Move connection state to the Router. Keep services HTTP-based and stateless.
No WebSocket servers in subgraphs
HTTP-only services
Subgraphs handle HTTP requests and publish events. They do not manage persistent client connections. Cosmo Streams moves connection management to the Router.
- HTTP only
- Publish events
- No connection state
Compatible with serverless
Request-based scaling
Services remain request-based, so they run seamlessly on Lambda, Cloud Run, and other short-lived compute platforms. The Router maintains client connections; services scale with request volume.
Works with your existing broker
Kafka, NATS, or Redis
The Router connects to Kafka, NATS (including JetStream), or Redis. No additional messaging layer required. Your services already publish events; Cosmo Streams exposes them as GraphQL subscriptions.
Subscription logic centralized
Router-level authorization
Authorization, filtering, and validation live in Router custom modules or schema directives. The Router manages subscription connections. Implement once, apply consistently.
When to Use Cosmo Streams
Three scenarios where it shines
Serverless, event-driven backends, or per-user subscription filtering — Cosmo Streams centralizes connection management in the Router.
Serverless
Subscriptions without persistent connections
Your services run on Lambda, Cloud Run, or similar. Cosmo Streams lets services remain request-based while the Router maintains connections to clients.
Event-driven
Backend already publishes events
Services publish to Kafka, NATS, or Redis. Cosmo Streams exposes selected events as GraphQL subscriptions without adding subscription infrastructure to each service.
Per-user data
Different results per subscriber
The same subscription should return different results by user. Cosmo Streams applies per-subscriber filtering and authorization in the Router.
FAQ
How Cosmo Streams works
- How does an event become a live update?
- Do services need to manage WebSocket connections?
- Do we need a new messaging infrastructure?
- What if subscriber counts grow?
Get started
Publish events. Deliver subscriptions. No connection management in your services.
Cosmo Streams moves subscription infrastructure into the Router. Your services stay HTTP-only.