| title | WebSocketLink |
|---|---|
| description | Execute subscriptions (or other operations) over WebSocket with the subscriptions-transport-ws library |
We no longer recommend using WebSocketLink or the subscriptions-transport-ws library, because the library is not actively maintained. To execute subscriptions, We instead recommend using the newer graphql-ws library with the accompanying GraphQLWsLink.
Whichever library you use, make sure you use the same library in your server and any clients you support. For more information, see Choosing a subscription library.
<DocBlock canonicalReference="@apollo/client/link/ws!WebSocketLink:class" customOrder={["summary", "remarks", "example"]} />
constructor(
paramsOrClient: WebSocketLink.Configuration | SubscriptionClient
): WebSocketLinkWebSocketLink requires the subscriptions-transport-ws library. Install it in your project:
npm install subscriptions-transport-ws