# graphql-ws

> Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client

Latest version **6.2.2** (published 2026-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-ws
pnpm add graphql-ws
yarn add graphql-ws
bun add graphql-ws
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.2.2 |
| Published | 2026-09-16 |
| First published | 2017-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 268.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1871 |
| Author | Denis Badurina |
| Maintainers | enisdenjo, theguild-bot |
| Keywords | protocol, graphql, transport, subscriptions, websockets, server, client, observables, express, relay, apollo, fastify, uwebsockets |

## Links

- npm: https://www.npmjs.com/package/graphql-ws
- Repository: https://github.com/enisdenjo/graphql-ws
- Homepage: https://the-guild.dev/graphql/ws
- Issues: https://github.com/enisdenjo/graphql-ws/issues
- npm.io page: https://npm.io/package/graphql-ws

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 6.2.2 (latest) — 2026-09-16
- 6.2.2-rc-b0ff8c3b2a686031889b706c261b49c9f503018b (rc) — 2026-09-11
- 6.0.8-alpha-7b80b2e5ad1f8317349be5b7d79e94f62ea864dc (alpha) — 2026-03-26
- 6.2.1 — 2026-08-06
- 6.2.0 — 2026-07-24
- 6.1.1 — 2026-07-22
- 6.1.1-rc-f25180b43ed97409d1aa503002825badb1fcfd10 — 2026-07-22
- 6.1.0 — 2026-07-10
- 6.1.0-rc-bd989b95f7215b9ec3f13ae4de52f6881d4b3e7a — 2026-07-10
- 6.0.8 — 2026-03-26
- 6.0.8-rc-a48f896493e12d0d98221ee57bfda0b1bd4eb1e3 — 2026-03-26
- 6.0.7 — 2026-01-27
- 6.0.7-rc-bb6f056fa4354d42d626530cdff7b4347cec8246 — 2026-01-27
- 6.0.7-alpha-02082131128b9c198b36c3d1ff9bd695ad4ca023 — 2026-01-26
- 6.0.7-alpha-543e5663d1ad697f98715ad8c50a5752b43446f6 — 2026-01-26
- … 169 more at https://npm.io/package/graphql-ws/versions

## README

<div align="center">
  <br />

![GraphQLOverWebSocket](https://user-images.githubusercontent.com/25294569/94527042-172dba00-023f-11eb-944b-88c0bd58a8d2.gif)

  <h6>Coherent, zero-dependency, lazy, simple, <a href="PROTOCOL.md">GraphQL over WebSocket Protocol</a> compliant server and client.</h6>

[![graphql-ws](https://img.shields.io/npm/v/graphql-ws.svg?label=graphql-ws&logo=npm)](https://www.npmjs.com/package/graphql-ws)

<i>Use [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) instead? Check out <b>[graphql-sse](https://github.com/enisdenjo/graphql-sse)</b>!</i>

  <br />
</div>

## [Get started](https://the-guild.dev/graphql/ws/get-started)

Swiftly start with the [get started guide on the website](https://the-guild.dev/graphql/ws/get-started).

## [Recipes](https://the-guild.dev/graphql/ws/recipes)

Short and concise code snippets for starting with common use-cases. [Available on the website.](https://the-guild.dev/graphql/ws/recipes)

## [Documentation](https://the-guild.dev/graphql/ws/docs)

Auto-generated by [TypeDoc](https://typedoc.org) and then [rendered on the website](https://the-guild.dev/graphql/ws/docs).

## [How does it work?](PROTOCOL.md)

Read about the exact transport intricacies used by the library in the [GraphQL over WebSocket Protocol document](PROTOCOL.md).

## [Want to help?](CONTRIBUTING.md)

File a bug, contribute with code, or improve documentation? Read up on our guidelines for [contributing](CONTRIBUTING.md) and drive development with `yarn test --watch` away!

## Disclaimer

This library and the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) are **not** cross-compatible with the [deprecated `subscriptions-transport-ws`](https://github.com/apollographql/subscriptions-transport-ws) and its [accompanying Protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md).

You must use `graphql-ws` coherently and implement the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) on both sides, server and the client.

---
_Source: https://npm.io/package/graphql-ws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
