Apollo Link WebSocket is a link for Apollo Client enabling GraphQL operations over WebSocket, specifically designed for subscriptions. The latest stable version is 1.0.20, released in March 2019. It is part of the Apollo Link ecosystem and relies on subscriptions-transport-ws (^0.9.0) as a peer dependency. Its key differentiator is seamless integration with Apollo Client for real-time GraphQL subscriptions, but it also supports queries and mutations over WebSocket. Note that development has shifted to the @apollo/client package since Apollo Client 3.0, rendering this package deprecated in favor of the built-in WebSocket support in @apollo/client.
npm install apollo-link-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a WebSocketLink using a SubscriptionClient and use it with Apollo Client.
Migrate to @apollo/client and use split with HttpLink and WebSocketLink from '@apollo/client/link/ws'
Update to new constructor syntax: new WebSocketLink(client) or new WebSocketLink({ uri: ... })Use named import: import { WebSocketLink } from 'apollo-link-ws'Install subscriptions-transport-ws as a dependency: npm install subscriptions-transport-ws
Migrate to graphql-ws and update the link or use @apollo/client's built-in WebSocket link
Run npm install apollo-link-ws
Use named import: import { WebSocketLink } from 'apollo-link-ws'Ensure you pass a valid SubscriptionClient instance: new SubscriptionClient('ws://...', { reconnect: true })