SSE

GraphQL subscriptions over plain HTTP

Zero-dependency, HTTP/1 safe, simple, spec compliant server and client. graphql-sse is the reference implementation of the GraphQL over Server-Sent Events protocol, and runs wherever a request handler does. Part of the Hive ecosystem by The Guild.

Streaming results, no WebSocket required

Subscribe in a few lines

Mount the handler on any HTTP server, then iterate over subscription events on the client with an async iterator; queries and mutations go through the same client.

Get started
import { createClient } from 'graphql-sse';

const client = createClient({
  url: 'http://localhost:4000/graphql/stream',
});

const subscription = client.iterate({
  query: 'subscription { greetings }',
});

for await (const event of subscription) {
  console.log(event.data); // { greetings: 'Hi' }, { greetings: 'Bonjour' }, ...
}

Learn more

Discover the complete ecosystem of tools and libraries

Complete GraphQL Federation Stack

Our libraries to support all your GraphQL needs

Explore the Ecosystem