apollo-link-ws

WebSocket transport layer for GraphQL

MIT 38 个版本
安装
npm install apollo-link-ws
yarn add apollo-link-ws
pnpm add apollo-link-ws
bun add apollo-link-ws
README

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.

版本列表
2.0.0-beta.0 2019-11-15
1.0.20 2020-04-09
1.0.19 2019-09-06
1.0.18 2019-06-14
1.0.17 2019-03-14
1.0.16 2019-03-14
1.0.15 2019-03-05
1.0.14 2019-02-01
1.0.13 2019-02-01
1.0.12 2018-12-15
1.0.11 2018-12-13
1.0.10 2018-11-21
1.0.9 2018-09-15
1.0.8 2018-04-12
1.0.7 2018-02-23
1.0.6 2018-02-21
1.0.5 2018-02-08
1.0.4 2017-12-18
1.0.3 2017-12-08
1.0.2 2017-11-30
1.0.1 2017-11-15
1.0.0 2017-10-24
0.6.0 2017-10-13
0.5.0 2017-10-03
0.4.1-beta.6 2017-09-28
0.4.1-beta.5 2017-09-25
0.4.1-beta.4 2017-09-21
0.4.1-beta.3 2017-09-25
0.4.1-beta.1 2017-09-19
0.4.1-beta.0 2017-09-13
0.3.4 2017-09-07
0.3.2 2017-09-07
0.3.0 2017-08-09
0.2.1 2017-08-09
0.2.0 2017-08-08
0.1.1 2017-08-08
0.1.0 2017-08-08
0.0.0 2017-08-01