docs/source/api/link/apollo-link-ws.mdx
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.
</Caution><DocBlock canonicalReference="@apollo/client/link/ws!WebSocketLink:class" customOrder={["summary", "remarks", "example"]} />
constructor(
paramsOrClient: WebSocketLink.Configuration | SubscriptionClient
): WebSocketLink
WebSocketLink requires the subscriptions-transport-ws library. Install it in your project:
npm install subscriptions-transport-ws
<InterfaceDetails canonicalReference="@apollo/client/link/ws!WebSocketLink.Configuration:interface" headingLevel={3} displayName="WebSocketLink.Configuration" />