WS

GraphQL over WebSocket, done by the book

Zero-dependency, lazy, simple, spec compliant server and client. graphql-ws is the reference implementation of the GraphQL over WebSocket protocol, with adapters for every popular WebSocket server. Part of the Hive ecosystem by The Guild.

Resilient subscriptions, without the ceremony

Subscribe in a few lines

Start a server on top of ws, then iterate over subscription events on the client with an async iterator; queries and mutations go through the same connection.

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

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

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