Constdiagram that explains the logic with an example.
import { GraphQLWsLink } from '@apollo/client'
import { stateSyncLink } from 'apollo-state-sync'
import { createSharedClient } from 'graphql-shared-ws'
const wsLink = new GraphQLWsLink(
createSharedClient({
url: 'wss://localhost:443/api/graphql',
})
)
const apolloClient = new ApolloClient({
link: ApolloLink.from([
authMiddleware,
// use stateSyncLink
stateSyncLink,
wsLink,
]),
cache: inMemoryStore,
})
A non-terminating ApolloLink, which tracks the count of in-flight GraphQL requests.