apollo-link-ws
TypeScript icon, indicating that this package has built-in type declarations

1.0.20 • Public • Published

title: apollo-link-ws description: Send GraphQL operations over a WebSocket. Works with GraphQL Subscriptions.

This link is particularly useful to use GraphQL Subscriptions, but it will also allow you to send GraphQL queries and mutations over WebSockets as well.

import { WebSocketLink } from "apollo-link-ws";
import { SubscriptionClient } from "subscriptions-transport-ws";
 
const GRAPHQL_ENDPOINT = "ws://localhost:3000/graphql";
 
const client = new SubscriptionClient(GRAPHQL_ENDPOINT, {
  reconnect: true
});
 
const link = new WebSocketLink(client);

Options

WS Link takes either a subscription client or an object with three options on it to customize the behavior of the link. Takes the following possible keys in the configuration object:

  • uri: a string endpoint to connect to
  • options: a set of options to pass to a new Subscription Client
  • webSocketImpl: a custom WebSocket implementation

By default, this link uses the subscriptions-transport-ws library for the transport.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.2069,611latest
2.0.0-beta.02beta

Version History

VersionDownloads (Last 7 Days)Published
1.0.2069,611
2.0.0-beta.02
1.0.198,452
1.0.18500
1.0.17427
1.0.161
1.0.152
1.0.1471
1.0.130
1.0.12115
1.0.111
1.0.1064
1.0.971
1.0.81,309
1.0.726
1.0.60
1.0.511
1.0.40
1.0.31
1.0.22
1.0.10
1.0.01
0.6.01
0.5.03
0.4.1-beta.60
0.4.1-beta.51
0.4.1-beta.31
0.4.1-beta.41
0.4.1-beta.10
0.4.1-beta.00
0.3.40
0.3.21
0.3.03
0.2.11
0.1.12
0.1.02
0.2.02
0.0.01

Package Sidebar

Install

npm i apollo-link-ws

Weekly Downloads

80,686

Version

1.0.20

License

MIT

Unpacked Size

17.7 kB

Total Files

18

Last publish

Collaborators

  • jbaxleyiii
  • apollo-bot