title: Socket.io perpetual disconnection on HTTP 2 due to missing Keep-Alive headers
body: <p>After having developed my application in an unsecured context using HTTP 1.1, I have now deployed it to a HTTP 2 server using HTTPS. All fine and dandy. For 30 seconds... :)</p>
  <p>After that, the socket disconnects and connects again. And again. And again.</p>
  <p><a href="https://i.stack.imgur.com/k1gQ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k1gQ4.png" alt="enter image description here" /></a></p>
  <p>What I saw missing from the server response are the <code>Connection: keep-alive</code> and <code>Keep-Alive: timeout=5</code> headers that I get on my HTTP 1.1 server. The code is absolutely identical and communication does work just fine.</p>
  <p>I suppose socket.io has some smart way of working over HTTP 2 but I couldn't find anything about this in the documentation.</p>
  <p>It's also interesting that the client DOES request the keep-alive header, despite it running on HTTP 2. But alas, nothing is returned and the socket disconnects :(</p>
  <p><a href="https://i.stack.imgur.com/Y645W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y645W.png" alt="enter image description here" /></a></p>
  <p>I noticed somebody tried using SPDY via Express:</p>
  <p><a href="https://stackoverflow.com/questions/38662677/getting-socket-io-express-node-http2-to-communicate-though-http-2">Getting socket.io, express &amp; node-http2 to communicate though HTTP/2</a></p>
  <p>I would consider this as a possible solution, but I would like this to work without SPDY as well.</p>