How to handle request disconnect in node/express app
<p>I have an express/node app and I would like to capture when there is an unexpected interruption in the connection. I tried the following:</p>

<pre><code>req.on('close', function () {
  //this captures the browser/tab close scenarios 
})
</code></pre>

<p>My code does not work in the following scenerios:</p>

<ul>
<li><p>Wifi is disconnected</p></li>
<li><p>Device shuts down due to lack of power</p></li>
</ul>

<p>Is there an event handler that could be leveraged in these scenarios?</p>