Skip to content

Releases: enisdenjo/graphql-ws

v5.10.2

12 Sep 17:35
Compare
Choose a tag to compare

5.10.2 (2022-09-12)

Performance Improvements

v5.10.1

19 Aug 13:46
Compare
Choose a tag to compare

5.10.1 (2022-08-19)

Bug Fixes

  • client: Debounce close by lazyCloseTimeout (c332837), closes #388

v5.10.0

09 Aug 15:12
Compare
Choose a tag to compare

5.10.0 (2022-08-09)

Features

v5.9.1

01 Jul 11:07
Compare
Choose a tag to compare

5.9.1 (2022-07-01)

Bug Fixes

  • Add types path to package.json exports (#375) (9f394d7)

v5.9.0

09 Jun 15:18
Compare
Choose a tag to compare

5.9.0 (2022-06-09)

Features

  • Descriptive invalid message errors (b46379e), closes #366

v5.8.2

12 May 15:13
Compare
Choose a tag to compare

5.8.2 (2022-05-12)

Bug Fixes

  • server: Should clean up subscription reservations on abrupt errors without relying on connection close (611c223)

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