title: How to reconnect socket.io client on activity after auto-reconnect times out?
body: <p>It is common for laptops to go to sleep. This causes the socket.io client to disconnect. When the user returns to the web app, the socket.io client doesn't try to reconnect (probably reconnection limit reached?). How do I tell the socket to reconnect if the user does some action?</p>
  
  <p>For example, I'd like the <code>emit</code> function to check if the connection is active, and if not then try to reconnect.</p>
  
  <p>Note: I only need the client-side JS code and I'm not using node.js.</p>