title: How to configure graphql-flutter and apollo sever that to make app stop disconnecting from websocket
body: <p>I am building app on flutter where i am using graphql-flutter package and my config look like this:</p>
  <pre><code>final WebSocketLink websocketLink = WebSocketLink(
      url: subscriptionUri,
      config: SocketClientConfig(
          autoReconnect: true,
          initPayload: () {
            return authTokenService.addAuthHeader(EnvVariables.currentHost);
          }));
  
  link = link.concat(websocketLink);
  </code></pre>
  <p>Also on backend i am using Apollo graphql with subscriptions and redis for PubSub which condfig looks like this:</p>
  <pre><code>this.pubsub = new RedisPubSub({
              publisher: new Redis(process.env.REDIS_URL),
              subscriber: new Redis(process.env.REDIS_URL),
          });
  </code></pre>
  <p>and Apollo</p>
  <pre><code>const apolloServer = new ApolloServer({
      schema,
      subscriptions: {
          keepAlive: 30000,  
      }...
  </code></pre>
  <p>All this is hosted on Heroku (not prod environment - free one - maybe thats an issue)
  So my app keeps disconnecting and reconnecting to websocket.
  <a href="https://i.stack.imgur.com/6Ss5Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Ss5Q.png" alt="enter image description here" /></a></p>
  <p>just before disconnecting i am getting a message: Have'nt received keep alive message for 30 seconds. Disconnecting...</p>
  <p>But if i pass null to inactivityTimeout in graphql-flutter package</p>
  <pre><code>final WebSocketLink websocketLink = WebSocketLink(
      url: subscriptionUri,
      config: SocketClientConfig(
          autoReconnect: true,
          inactivityTimeout: null,
          initPayload: () {
            return authTokenService.addAuthHeader(EnvVariables.currentHost);
          }));
  
  link = link.concat(websocketLink);
  </code></pre>
  <p>After some time app throws error that - max retries limit reached.</p>
  <p>So how should i configure both sides correctly? Should i send keepAlive messages or just ignore them on flutter side but then how to avoid max retries error?
  Or maybe i should manually send any message to channel to keep it active liek it says here: <a href="https://devcenter.heroku.com/articles/play-java-websockets-advanced" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/play-java-websockets-advanced</a> (but i would expect that apollo server would do it for me...)</p>
  <p>Thanks</p>