Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-ws

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-ws - npm Package Versions

1
11

5.1.0

Diff

Changelog

Source

5.1.0 (2021-06-09)

Features

  • client: disablePong option for when implementing a custom pinger (6510360), closes #117
  • Optional payload for ping/pong message types (2fe0345), closes #117
enisdenjo
published 5.0.0 •

Changelog

Source

5.0.0 (2021-06-08)

Features

  • Bidirectional ping/pong message types (#201) (1efaf83)
  • client: Rename keepAlive option to lazyCloseTimeout (3c1f13c)
  • uWebSockets: Drop deprecated request context extra (02ea5ee)

BREAKING CHANGES

  • Because of the Protocol's strictness, an instant connection termination will happen whenever an invalid message is identified; meaning, all previous implementations will fail when receiving the new subprotocol ping/pong messages.

Beware, the client will NOT ping the server by default. Please make sure to upgrade your stack in order to support the new ping/pong message types.

A simple recipe showcasing a client that times out if no pong is received and measures latency, looks like this:

import { createClient } from 'graphql-ws';

let activeSocket,
  timedOut,
  pingSentAt = 0,
  latency = 0;
createClient({
  url: 'ws://i.time.out:4000/and-measure/latency',
  keepAlive: 10_000, // ping server every 10 seconds
  on: {
    connected: (socket) => (activeSocket = socket),
    ping: (received) => {
      if (!received /* sent */) {
        pingSentAt = Date.now();
        timedOut = setTimeout(() => {
          if (activeSocket.readyState === WebSocket.OPEN)
            activeSocket.close(4408, 'Request Timeout');
        }, 5_000); // wait 5 seconds for the pong and then close the connection
      }
    },
    pong: (received) => {
      if (received) {
        latency = Date.now() - pingSentAt;
        clearTimeout(timedOut); // pong is received, clear connection close timeout
      }
    },
  },
});
  • uWebSockets: The deprecated uWebSockets request context extra field has been dropped because it is stack allocated and cannot be used ouside the internal upgrade callback.
  • client: Client keepAlive option has been renamed to lazyCloseTimeout in order to eliminate ambiguity with the client to server pings keep-alive option.
enisdenjo
published 4.9.0 •

Changelog

Source

4.9.0 (2021-06-06)

Features

enisdenjo
published 4.8.0 •

Changelog

Source

4.8.0 (2021-06-03)

Features

  • uWebSockets: Add persistedRequest to context extra and deprecate uWS's stack allocated request (#196) (736e6ed)
enisdenjo
published 4.7.0 •

Changelog

Source

4.7.0 (2021-05-31)

Features

  • Add extensions field to the subscribe message payload (d86a8e4)
enisdenjo
published 4.6.0 •

Changelog

Source

4.6.0 (2021-05-30)

Features

  • use: Generic for extending the context extras (401cd4c), closes #189
enisdenjo
published 4.5.2 •

Changelog

Source

4.5.2 (2021-05-28)

Bug Fixes

  • uWebSockets: Handle premature and abrupt socket closes (9d3ff52), closes #186
enisdenjo
published 4.5.1 •

Changelog

Source

4.5.1 (2021-05-18)

Bug Fixes

  • server: Init context first on connection open (a80e753), closes #181
enisdenjo
published 4.5.0 •

Changelog

Source

4.5.0 (2021-04-29)

Features

  • Support custom JSON message reviver and replacer (#172) (0a9894e)
enisdenjo
published 4.4.4 •

Changelog

Source

4.4.4 (2021-04-28)

Bug Fixes

  • client: complete should not be called after subscription error (1fba419)
  • client: Subscription can be disposed only once (abd9c28), closes #170
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc