title: Events for network status change in Node.js?
body: <p>All the solutions I've found simply poll a service. E.g. they ping <code>google.com</code> every second to see if the Node service has Internet access.</p>
  
  <p>However, I'm looking for a cleaner event-based solution. In the browser, there's <code>window.ononline</code> and <code>window.onoffline</code>. I know these aren't perfect, but they're still better than nothing.</p>
  
  <p>I'm not necessarily looking for a way to see if a Node service is online, I'm just looking for a way to see if the OS thinks it's online. E.g. if the OS isn't connected to any network interfaces, then it's definitely offline. However, if it's connected to a router, then I can maybe ping <code>google.com</code>.</p>