title: Socket IO reconnect?
body: <p>How to reconnect to socket io once <code>disconnect</code> has been called?</p>
  
  <p>Here's the code</p>
  
  <pre><code>function initSocket(__bool){                    
      if(__bool == true){             
          socket = io.connect('http://xxx.xxx.xxx.xxx:8081', {secure:false});     
          socket.on('connect', function(){console.log('connected')});                                 
          socket.on('disconnect', function (){console.log('disconnected')});
      }else{
          socket.disconnect();
          socket = null;
      }
  }   
  </code></pre>
  
  <p>If I do <code>initSocket(true)</code>, it works. If I do <code>initSocket(false)</code>, it disconnects. BUT THEN if I try to reconnect using <code>initSocket(true)</code>, the connection does not work anymore. How can I get the connection to work?</p>