qmetrics.net

GraphQL Ws

GraphQL over WebSocket protocol client and server library

GraphQL Ws screenshot

graphql-ws implements the GraphQL over WebSocket protocol on server and client. It provides zero-dependency handlers and adapters for common WebSocket stacks in JavaScript runtimes.

Overview

graphql-ws is a library that implements the GraphQL over WebSocket protocol for both server and client sides. It serves as the reference implementation of that protocol and is designed to be small, lazy, and free of extra dependencies.

On the server, ready-made handlers integrate with WebSocket libraries such as ws, uWebSockets.js, Fastify’s websocket plugin, Bun, Deno, and crossws. A protocol-only server can also plug into other WebSocket implementations. Authentication, ping and pong keepalive, and subscription iteration are supported through the API.

The client side exposes APIs to connect over a WebSocket URL and iterate subscription events, with queries and mutations shareable on the same connection. Recipes cover Relay, urql, Apollo, authentication, persisted queries, and related patterns.

The library is not compatible with the older subscriptions-transport-ws protocol; both endpoints must speak GraphQL over WebSocket. It is part of The Guild’s Hive ecosystem, with related Server-Sent Events work available in a separate graphql-sse project.

Key features

  • GraphQL over WebSocket protocol
  • Server and client in one package
  • Adapters for ws and Fastify
  • uWebSockets.js and Bun support
  • Deno and crossws integration
  • Ping and pong keepalive
  • Async iterator client subscriptions
  • Recipes for popular GraphQL clients

Use cases

  • GraphQL subscriptions over WebSocket
  • Reference protocol implementation
  • Custom WebSocket GraphQL servers
  • Client subscriptions with retry control
  • Replacing deprecated WS subscription transports

Tags

Similar software

FastAPI

Python web framework for building APIs with type hints

FastAPI is a Python web framework for building APIs using standard type hints. It builds on Starlette and Pydantic and generates interactive OpenAPI documentation for the endpoints you define.

★ 105.1k⟳ 9 days agoMIT

NestJS

Progressive TypeScript framework for Node.js backends

Nest organizes Node server apps with modules, dependency injection, and first-party packages for auth, data, queues, and observability.

★ 77.2k⟳ todayMIT

OkHttp

HTTP client for JVM, Android, and GraalVM

OkHttp is an HTTP client library tuned for efficient networking on Android, Java, and GraalVM native images. It offers synchronous and asynchronous call APIs with a fluent request builder.

★ 47.1k⟳ yesterdayApache-2.0
Frameworks & PlatformsDesktop/CLI app

gRPC

Cross-language remote procedure call framework

gRPC is an RPC framework that lets client and server programs communicate transparently and supports building connected, multi-language systems.

★ 45.5k⟳ todayApache-2.0

tRPC

End-to-end typesafe TypeScript APIs without code generation

tRPC helps teams define server procedures and call them from clients with full TypeScript types for inputs, outputs, and errors—no schemas or codegen step.

★ 40.9k⟳ todayMIT
Frameworks & PlatformsDesktop/CLI app

go-zero

Cloud-native Go microservices and RPC framework

go-zero is a Go web and RPC framework with code generation, built-in resilience middleware, and tooling aimed at stable high-traffic services.

★ 33.5k⟳ 9 days agoMIT