title: check for internet connectivity using WebSocketLink from apollo-link-ws
body: <p>I'm trying to check for internet connectivity using apollo websockets, the purpose of this is to show a "you're disconnected" message when there is no connection to prevent the user from typing and assuming the changes are saved (the changes are supposedly saved on type), here's part of the setup of apollo-link-ws</p>
  
  <pre><code>const wsLink = new WebSocketLink({
  uri: `ws://${hostname}${port ? `:${port}` : ''}/subscriptions`,
  options: {
   reconnect: true,
   connectionParams: () =&gt; ({
    authorization: localStorage.getItem('accelerator-token')
   })
  }
  });
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    const hasSubscriptionOperation = ({ query: { definitions } }) =&gt;
      definitions.some(
      ({ kind, operation }) =&gt;
        kind === 'OperationDefinition' &amp;&amp; operation === 'subscription'
    );
  </code></pre>
  
  <p>and here's the client config:</p>
  
  <pre><code>const client = new ApolloClient({
  link: ApolloLink.split(
      hasSubscriptionOperation,
      wsLink,
      ApolloLink.from([
        cleanTypenameLink,
        authMiddleware,
        errorLink,
        stateLink,
        createUploadLink()
      ])
    ),
    cache
  });
  </code></pre>