Skip to content

Releases: enisdenjo/graphql-ws

v5.8.1

25 Apr 13:29
Compare
Choose a tag to compare

5.8.1 (2022-04-25)

Bug Fixes

  • client: isFatalConnectionProblem defaults to undefined for using shouldRetry (9d5c573)

v5.8.0

25 Apr 12:29
Compare
Choose a tag to compare

5.8.0 (2022-04-25)

Features

  • client: Deprecate isFatalConnectionProblem option in favour of shouldRetry (d8dcf21)

Client usage with retry on any connection problem

import { createClient } from 'graphql-ws';
import { waitForHealthy } from './my-servers';

const client = createClient({
  url: 'ws://any.retry:4000/graphql',
  // by default the client will immediately fail on any non-fatal
  // `CloseEvent` problem thrown during the connection phase
  //
  // see `retryAttempts` documentation about which `CloseEvent`s are
  // considered fatal regardless
  shouldRetry: () => true,
  // or pre v5.8.0:
  // isFatalConnectionProblem: () => false,
});

v5.7.0

07 Apr 20:48
Compare
Choose a tag to compare

5.7.0 (2022-04-07)

Features

  • client: Terminate the WebSocket abruptly and immediately (53ad515), closes #290

Client usage with abrupt termination on pong timeout

import { createClient } from 'graphql-ws';

let timedOut;
const client = createClient({
  url: 'ws://terminate.me:4000/on-pong-timeout',
  keepAlive: 10_000, // ping server every 10 seconds
  on: {
    ping: (received) => {
      if (!received /* sent */) {
        timedOut = setTimeout(() => {
          // a close event `4499: Terminated` is issued to the current WebSocket and an
          // artificial `{ code: 4499, reason: 'Terminated', wasClean: false }` close-event-like
          // object is immediately emitted without waiting for the one coming from `WebSocket.onclose`
          //
          // calling terminate is not considered fatal and a connection retry will occur as expected
          //
          // see: https://github.com/enisdenjo/graphql-ws/discussions/290
          client.terminate();
        }, 5_000);
      }
    },
    pong: (received) => {
      if (received) {
        clearTimeout(timedOut);
      }
    },
  },
});

v5.6.4

24 Mar 15:42
Compare
Choose a tag to compare

5.6.4 (2022-03-24)

Bug Fixes

  • Warn about subscriptions-transport-ws clients and provide migration link (e080739), closes #339, related #325

v5.6.3

13 Mar 22:33
Compare
Choose a tag to compare

5.6.3 (2022-03-13)

Bug Fixes

  • client: Stop execution if connectionParams took too long and the server kicked the client off (1e94e45), closes #331

v5.6.2

23 Feb 14:44
Compare
Choose a tag to compare

5.6.2 (2022-02-23)

Bug Fixes

  • server: handleProtocols accepts arrays too and gracefully rejects other types (98dec1a), closes #318

v5.6.1

21 Feb 22:08
Compare
Choose a tag to compare

5.6.1 (2022-02-21)

Bug Fixes

  • server: Handle upgrade requests with multiple subprotocols and omit Sec-WebSocket-Protocol header if none supported (9bae064)

v5.6.0

19 Feb 22:15
Compare
Choose a tag to compare

5.6.0 (2022-02-19)

Features

  • TypeScript generic for connection init payload (connectionParams) (#311) (e67cf80)

v5.5.5

29 Oct 15:53
Compare
Choose a tag to compare

5.5.5 (2021-10-29)

Bug Fixes

  • client: Limit client emitted error close message size (2d959f6)
  • client: Report close causing internal errors to error listeners (4e7e389)

v5.5.4

27 Oct 16:56
Compare
Choose a tag to compare

5.5.4 (2021-10-27)

Bug Fixes

  • fastify-websocket: Handle connection and socket emitted errors (71e9586)
  • fastify-websocket: Handle server emitted errors (3fa17a7)
  • ws: Handle socket emitted errors (a22c00f)
  • ws: Limit server emitted error close message size (50620df)
  • ws: Log server emitted errors to the console (0826b0a)