graphql-ws VS ws

Compare graphql-ws vs ws and see what are their differences.


Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. (by enisdenjo)


Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js (by websockets)
Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • Scout APM - Less time debugging, more time building
graphql-ws ws
17 14
1,103 18,206
- 1.6%
9.0 8.2
11 days ago 2 days ago
TypeScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of graphql-ws. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-04-27.
  • GraphQL Subscriptions: Why we use SSE/Fetch over Websockets
    2 projects | | 27 Apr 2022
    There is already a JavaScript implementation for server + client with support for multiplexing from the same maintainer of graphql-ws: graphql-sse
  • how it subscription work on the apollo server?
    3 projects | | 26 Apr 2022
    Actually WebSocket is not the only protocol for executing GraphQL subscriptions. There is also a graphql-over-sse protocol, which is much more lightweight, and uses Server Sent Events. A popular implementation of it is the graphql-sse library, which is maintained by the same person as graphql-ws. The setup and API of both libraries is pretty similar.
  • Advice on using graphql-ws with Apollo/React
    2 projects | | 25 Oct 2021
    That said, I feel so close to success that I can't quite give up. I am using graphql-ws as I understand this to be the new standard implementation of GraphQL Subscriptions. However, of course, Apollo subscriptions have not been updated to implement this. So, looking at the Recipes over on the graphql-ws documentation I have found the guide for using Apollo client. However as I am new to Apollo, it is using a lot of terms I am unfamiliar with.
  • GraphQL Subscriptions and Mikro-Orm in 2021
    2 projects | | 14 Oct 2021
    Okay but seriously, if you've fallen down the rabbit hole of Apollo docs pointing you towards one library (subscription-transport-ws) which then points you to another (graphql-ws) , and so on and so forth, then hopefully this helps pull you out.
  • How does a client know if the server managing its subscription goes offline? (Multiple instances)
    2 projects | | 23 Sep 2021
    The most common protocol used today for subscriptions is the Apollo websocket protocol.
  • Graphql Subscriptions w/o apollo
    1 project | | 15 Sep 2021
    GraphQL subscriptions are just web sockets. You can check graphql-ws package if you want something without Apollo dependency. Though I don't understand why you want to not depend on it in the first place.
  • GraphQL Tools V8 - Stitch Federation Services
    4 projects | | 29 Jul 2021
    New GraphQL-WS ✔️
  • Subscriptions and Live Queries - Real Time with GraphQL
    5 projects | | 29 Jul 2021
    The interesting thing is that we can use any transport for delivering the results to client. The most popular implementation (as mentioned before) is subscriptions-transport-ws. Unfortunately, since it is poorly maintained, the GraphQL Working Group came up with a new implementation over WebSockets, graphql-ws.
  • GraphQL over WebSockets
    9 projects | | 29 Jul 2021
    Okay, so, how do I use WebSockets to add support for the GraphQL subscription operation? Doing a basic Google search, you’d be faced with a single solution, namely subscriptions-transport-ws. Looking through the repository, checking recent comments, reading through the issues and open PRs - might have you notice the abundance of bugs and their security implications. A summary can be found here.
  • I need a little help implementing user online status tracking with Apollo/GraphQL.
    7 projects | | 10 Jun 2021
    Have you thought about using graphql-ws instead? It uses the new graphql-transport-ws protocol which also has an open RFC that is discussed in the GraphQL working Groups.


Posts with mentions or reviews of ws. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-07.
  • Why is the session, user etc empty or undefined inside the websocket when logged in with passport?
    1 project | | 31 Jan 2022
    the official example here for ws is using noServer mode. according to their docs, if you dont use noServer you wont be able to parse the session because the upgrade callback wont be called
  • Top WebSocket libraries for Node.js in 2022
    12 projects | | 7 Jan 2022
    With over 17.5k stars on GitHub and about 35 million weekly downloads on npm, ws is one of the most popular Node.js WebSocket libraries available.
  • Multiplayer snake cloud server
    3 projects | | 5 Jan 2022
    i've also just recently started working on multiplayer web game tech, so i've implemented websocket communication (using ws) in my experimental library renraku, which is the basis of the signalling server in sparrow-rtc, which is a peer-to-peer realtime communications library for our forthcoming project if you're interested in the open source libraries, you could join our discord and i'd be happy to help you get setup, since they aren't quite yet documented :)
  • How do web apps integrate webhooks when the user needs frequent updates?
    2 projects | | 24 Sep 2021
  • GraphQL over WebSockets
    9 projects | | 29 Jul 2021
    With ws
  • Recommendations for WebSocket libraries
    1 project | | 17 Jul 2021
    Highly recommend to not use a library (like that requires you to use a specific client/server. I've found that the browser WebSocket class is more than sufficient in most cases and very easy to use. And similarly, a server-side library like ws (if you have a Node.js server) is similarly easy to use. The logic of this is that websockets are very similar to TCP sockets which is the standard for native clients (non-web) and using a lower-level library will make it far easier to switch out technologies, languages, and network protocols if necessary.
  • Understanding someone else code
    1 project | | 29 Jun 2021
  • Back with one more question about WebSockets
    1 project | | 17 Jun 2021
    You need to spend a bit more time reading documentation for your library. Take a look at this: In the example they have an interval loop outside of the 'connection' and 'message' loop. You'll need to rearrange your code and declare web socket server object as a variable so you can later refer to it. I have some methods that are run as the application starts (things like db connection, node server confuguration, seeding the db) and that's where you'd keep this sort of things - ideally in a separate method that configures WS server. Talking about documentation and web sockets, I have also found a lot of useful info here: and here: That is assuming that you're using RxJs for handling your WS connection, which is my recommendation after spending a fair mount of time with WS last year.
  • Is it possible to receive websocket messages in Node?
    1 project | | 2 Jun 2021
    This client will stay open for as long as the websocket connection to the server is maintained. If the server disconnects it, or if there is a network issue, the script will stop. You could build this into a more complex script that checks for the close, error or unexpected-response events and gracefully tries to reconnect to the server after a specified time. Then you could run this as a persistent script that will keep running indefinitely. See this page for some more documentation:
  • How to setup my environment for realtime data with WebSockets
    1 project | | 12 Apr 2021
    I was planning to use React with WebSockets ( to get realtime data from EXTERNAL source. I tried it first in a plain Node.js project and it went perfectly fine. Then I tried implementing that same code in React, and now I get CORS problems from that server.

What are some alternatives?

When comparing graphql-ws and ws you can also consider the following projects:

subscriptions-transport-ws - :arrows_clockwise: A WebSocket client + server for GraphQL subscriptions

fastify-websocket - basic websocket support for fastify

apollo-server - 🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more. - Realtime application framework (Node.JS server)

redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development

GraphQL Kotlin - Libraries for running GraphQL in Kotlin

graphql-helix - A highly evolved GraphQL HTTP Server 🧬

uWebSockets.js - μWebSockets for Node.js back-ends :metal:

graphql-sse - Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.

Passport - Simple, unobtrusive authentication for Node.js.

better-sqlite3 - The fastest and simplest library for SQLite3 in Node.js.