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.2058,981latest
2.0.0-beta.03beta

Version History

VersionDownloads (Last 7 Days)Published
1.0.2058,981
2.0.0-beta.03
1.0.193,419
1.0.18407
1.0.17510
1.0.161
1.0.152
1.0.14150
1.0.130
1.0.121,071
1.0.112
1.0.10192
1.0.950
1.0.8853
1.0.742
1.0.61
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.01
0.6.00
0.5.03
0.4.1-beta.61
0.4.1-beta.50
0.4.1-beta.30
0.4.1-beta.40
0.4.1-beta.10
0.4.1-beta.00
0.3.41
0.3.21
0.3.00
0.2.11
0.1.10
0.1.00
0.2.00
0.0.00

Package Sidebar

Install

npm i apollo-link-ws

Weekly Downloads

65,692

Version

1.0.20

License

MIT

Unpacked Size

17.7 kB

Total Files

18

Last publish

Collaborators

  • jbaxleyiii
  • apollo-bot