Cosmo Streams

Real-time GraphQL that scales to any load

Five subscription protocols with connection multiplexing, plus event-driven subscriptions via Kafka, NATS, and Redis.

Protocol-based subscriptions and event-driven EDFS. Choose what your architecture needs.

Overview

Two approaches to real-time GraphQL

Cosmo Router provides subscription support out of the box. GraphQL Subscriptions handles multiple protocols and connection multiplexing. Cosmo Streams (EDFS) connects the Router directly to message brokers, making subgraphs completely stateless.

Both approaches work within the same federated graph. Use protocol subscriptions for existing WebSocket subgraphs. Use Cosmo Streams when moving to serverless, working with Kafka or NATS, or reducing connection overhead at scale.

Why it matters

Why GraphQL subscriptions at scale are hard

Real-time features should not require stateful subgraphs, three WebSocket connections per client, or weeks of custom infrastructure work.

Four problems that arise with traditional GraphQL subscriptions.

WebSocket subscriptions require stateful subgraphs.

Every active subscription lives in subgraph memory. Serverless deployments become impossible because Lambda and Cloud Run cannot maintain long-lived connections.

Three connections per client adds up fast.

Client to Router, Router to Subgraph, internal subgraph state. At 10,000 clients, connection overhead alone can consume substantial memory resources.

Protocol mismatches block real-time features.

Legacy mobile apps, modern web clients, and Elixir backends all use different protocols. Without a translator, each protocol requires a separate implementation.

Federated subscriptions require inter-subgraph coordination.

When entity fields come from multiple subgraphs, no single subgraph owns the subscription root. Coordinating updates across subgraphs is a hard problem with no standard solution.

Cosmo Router handles all four. Protocol translation, multiplexing, and event-driven stateless subscriptions.

Cosmo Streams capabilities

GraphQL Subscriptions

Five subscription protocols supported between clients and the Router, and between the Router and each subgraph. Connection multiplexing groups subscriptions with matching authentication into single upstream connections, reducing backend connection count significantly.

Free / Pro / Enterprise

Use cases

Streams use cases

Real-time dashboards, serverless deployments, and high-scale notifications.

Real-time dashboard

Live dashboards with multiplexed WebSocket connections

Scenario

A fintech application displays real-time prices and portfolio values to thousands of concurrent users.

How Cosmo handles it

Clients connect via graphql-ws. The Router multiplexes all subscriptions for the same data through shared connections to the pricing subgraph. Header-based authentication groups connections.

Outcome

10,000 connected clients consume connection resources of far fewer upstream connections.

Serverless real-time

Serverless subgraphs with real-time subscription support

Scenario

An engineering team wants to deploy subgraphs on AWS Lambda or Cloud Run but cannot because subscriptions require persistent connections.

How Cosmo handles it

Subgraphs publish events to NATS when data changes. The Router subscribes to topics and fetches current state via HTTP when events arrive. Lambda handles only stateless HTTP requests.

Outcome

Full serverless deployment with real-time subscription support.

High-scale notifications

Push updates to large numbers of concurrent users

Scenario

A platform needs to push updates to many concurrent users without overwhelming infrastructure.

How Cosmo handles it

Backend services publish notifications to Redis Pub/Sub. The Router handles all client connections with efficient I/O. Subscription deduplication ensures each unique notification is fetched once regardless of subscriber count.

Outcome

Subscriptions scale without linear growth in backend connection count or resource usage.

Which capability do you need?

If you are…Start here
Needing WebSocket support with multiple protocol optionsGraphQL Subscriptions
Moving subgraphs to serverless deploymentsCosmo Streams (EDFS)
Integrating Kafka, NATS, or Redis as the event sourceCosmo Streams (EDFS)
Supporting legacy clients alongside modern clientsGraphQL Subscriptions
Reducing memory and connections at high client countsCosmo Streams (EDFS)

How Cosmo Streams compares

Cosmo StreamsTraditional GraphQL SubscriptionsCustom Event Gateway
Subgraph stateStateless (HTTP only)Stateful (WebSockets)Varies
Serverless compatibleYesNoRequires custom work
Message broker integrationNative (Kafka, NATS, Redis)NoneDIY
Subscription deduplicationAutomaticManualDIY
Protocol options5 protocolsVaries by frameworkCustom

Why teams use Cosmo Streams

  • Five subscription protocols, automatic translation. graphql-ws, SSE (GET and POST), Multipart HTTP, subscriptions-transport-ws, and Absinthe. The Router translates between client and subgraph protocols automatically.
  • Event-driven subscriptions for stateless subgraphs. Kafka, NATS, and Redis Pub/Sub connect directly to the Router. Subgraphs publish events and serve plain HTTP. No WebSocket servers in subgraphs.
  • Connection multiplexing reduces upstream connections. The Router groups subscriptions with matching authentication headers into shared upstream connections, reducing backend connection count.
Get started

Add real-time to your federated graph