Package Exports
- apollo-link-ws
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (apollo-link-ws) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
WebSocket Link
Purpose
An Apollo Link to allow sending a request over a web socket.
Installation
npm install apollo-link-ws --save
Usage
import WSLink 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 WSLink(client);
Options
WS Link takes either a subscription client or an object with three options on it to customize the behavoir of the link.
uri: string; options?: ClientOptions; webSocketImpl?: any;
name | value | default | required |
---|---|---|---|
uri | string | NA | false |
options | Subscription ClientOptions | NA | false |
webSocketImpl | WebSocket implementation | NA | false |
By default, this link uses the subscriptions-transport-ws library for the transport.
Context
The WS Link does not use any keys on the context.