apollo-link-socket

Socket your Apollo with this handy Link!

Usage no npm install needed!

<script type="module">
  import apolloLinkSocket from 'https://cdn.skypack.dev/apollo-link-socket';
</script>

README

Apollo Link Socket

Socket your Apollo with this handy Link!

This library aims to add WebSocket support to Apollo Client in a sever-abstract manner.

Use

  1. Bring your own socket to the party
const socket: WebSocket = new WebSocket('wss://mywebsocket.com')
  1. Create a link with the socket
const socketLink = createWebSocketLink(socket)
  1. Toss that link in your Apollo client
const client = new ApolloClient({
  link: ApolloLink.from([
    ...,
    socketLink,
    ...
  ])
})

How it works

Building

  1. Clone me and yarn install the dependencies
  2. Run yarn build to JavaScript the TypeScript
  3. Run yarn test to make sure all the things installed and build correctly