title: Socket heartbeat vs keepalive
body: <p>What are pros and cons for implementing own heartbeat and setting`keepalive for a socket? </p>
  
  <p>I read somewhere, that keepalive sometimes can fail and connection will be closed anyway (depends on network structure). Another thing is that own heartbeat can detect if application is responsive (not only the socket). </p>
  
  <p>My main goal is to ensure all of these: keep connection alive, even though no data is send (beside possible heartbeat), fast connection loss detection on both sides, application responsiveness detection. </p>
  
  <p>I have already implemented a simple heartbeat on two ends and it works great, however I wonder if maybe I could replace it with out of the box keepalive feature.</p>