unstale

npm / graphql-ws

graphql-ws

What changed in graphql-ws 5 to 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

20 breaking2 security6 new APIs and options1 behavior and defaults15 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

graphql-ws 634 changes

Breaking changes 14

  • Removed from graphql-ws peer dependencies because it no longer exists on npm; using graphql-ws with uWebSockets.js still works.

    6.0.7release notes

  • The @fastify/websocket WebSocket in the context extra is now named socket instead of connection.

    6.0.0release notes

  • ErrorMessage now uses GraphQLFormattedError instead of GraphQLError.

    6.0.0release notes

  • Support for the deprecated fastify-websocket package was dropped; use @fastify/websocket.

    6.0.0release notes

  • Handler imports no longer include the /lib/ path segment; update imports to use the new package paths.

    6.0.0release notes

  • The least supported graphql peer dependency is ^15.10.1 and ^16.

    6.0.0release notes

  • The deprecated isFatalConnectionProblem option was removed; use shouldRetry, whose result is inverted.

    6.0.0release notes

  • The deprecated isMessage API was removed; use validateMessage, which throws when a message is invalid.

    6.0.0release notes

  • NextMessage now uses FormattedExecutionResult instead of ExecutionResult.

    6.0.0release notes

  • The least supported Node version is now v20.

    6.0.0release notes

  • onError now returns GraphQLFormattedError instead of GraphQLError.

    6.0.0release notes

  • onNext now returns FormattedExecutionResult instead of ExecutionResult.

    6.0.0release notes

  • The schema, context, and lifecycle hooks now receive an ID and relevant payload instead of the full accompanying message; several hooks also gain payload access.

    6.0.0release notes

  • Support for ws v7 was dropped; upgrade to v8.

    6.0.0release notes

Security 1

  • The ws, uWebSockets.js, and @fastify/websocket use-server helpers now accept isProd to control whether internal error messages are masked before reaching the client.

    6.4.0release notes

New APIs and options 4

  • Adds a server callback that receives the connection Context and ping payload. Its automatic pong reply is preserved; the low-level websocket onPing listener still disables automatic replies.

    6.3.0release notes

  • Adds a server callback that receives the connection Context and pong payload, allowing apps to log or react to subprotocol-level pongs with access to connection state.

    6.3.0release notes

  • Adds a parse option for custom GraphQL parsing.

    6.2.0release notes

  • Importing the client from graphql-ws/client allows non-browser environments to use it without depending on graphql.

    6.0.0release notes

Behavior and default changes 1

  • Errors thrown from subscription iterables are reported through ErrorMessage and terminate only the affected subscription, rather than the whole WebSocket connection.

    6.0.0release notes

Fixes and other changes 14

  • Disposing the client now clears the pending lazy close timeout, preventing it from holding on to the disposed client until it fires.

    6.4.3release notes

  • Each socket now waits for its own backpressure to drain, so an operation on one backpressured socket is not stalled by another socket.

    6.4.2release notes

  • Operations are completed when a socket closes while backpressured.

    6.4.2release notes

  • The client and server now use jsonMessageReplacer when automatically responding to a ping with a pong.

    6.4.1release notes

  • The client now uses a single lazy close timeout and checks for active subscriptions before closing, preventing an in-use socket from closing when a new subscription starts within the timeout.

    6.4.0release notes

  • Avoids an unhandled rejection when a subscription is disposed before the connection is acknowledged and the socket closes before the subscription releases its connection lock.

    6.4.0release notes

  • Fixes the client leaking memory per operation on long-living connections.

    6.3.0release notes

  • Allows operation IDs that match properties inherited from Object.prototype.

    6.3.0release notes

  • Support crossws 0.4 by selecting the GraphQL WebSocket subprotocol during the upgrade handshake, while preserving automatic protocol negotiation in legacy crossws 0.3 Node and uWebSockets adapters.

    6.2.2release notes

  • The CrossWS adapter now honors socket closes issued from server.opened, preventing protocol-mismatch closes from being dropped and the WebSocket from remaining open without a ConnectionAck.

    6.2.2release notes

  • Fixes the typings for WebSocketServer.

    6.2.1release notes

  • Disposing an event listener twice no longer removes an unrelated listener, including during nested emits.

    6.1.1release notes

  • Adds support for graphql@17, allowing graphql-ws to be used with that version of graphql.

    6.1.0release notes

  • When a subscription's async iterable throws an error, the server now sends only an Error message and does not follow it with a Complete message.

    6.0.8release notes

graphql-ws 510 changes

Breaking changes 6

  • The minimum supported version of the graphql-js package is now 16.

    5.0.0upgrade guide

  • Renames the client keepAlive option to lazyCloseTimeout to eliminate ambiguity with the client-to-server ping keep-alive option.

    5.0.0release notes

  • Yoga v6 requires Node.js 22 or later.

    5.0.0upgrade guide

  • An invalid message now causes instant connection termination; previous implementations fail when receiving the new subprotocol ping/pong messages.

    5.0.0release notes

  • Drops the deprecated uWebSockets request context extra field because it is stack allocated and cannot be used outside the internal upgrade callback.

    5.0.0release notes

  • Use yoga.log instead of yoga.logger for server-level messages; request-specific messages should use the request context logger.

    5.0.0upgrade guide

Security 1

  • Set requestId.trustHeader to false to prevent trusting a client-supplied x-request-id header.

    5.0.0upgrade guide

New APIs and options 2

  • Clients can request the current incremental delivery format with multipart/mixed;incrementalSpec=v0.2; Yoga echoes the value in the response Content-Type.

    5.0.0upgrade guide

  • Adds bidirectional ping/pong message types to the protocol.

    5.0.0release notes

Fixes and other changes 1

  • The migration instructions install the package with npm i graphql-yoga.

    5.0.0upgrade guide