title: webpack hmr + socketio "user connected" spam when initialize
body: <p>I'm trying socketio with webpack dev server using hmr. I'm not sure if it's related to my problem.</p>
  
  <p>This is the most simple example I use:</p>
  
  <p>Server side:</p>
  
  <pre><code>this.io.on('connection', function(socket){
     console.log('a user connected');
  });
  </code></pre>
  
  <p>Client side (inside a react component):</p>
  
  <pre><code>componentDidMount() {
      var socket = io();
  }
  </code></pre>
  
  <p>The problem when I do that it's "a user connected" appears a lot on the server side like if io() function is constantly called. It's spamming io connection.</p>
  
  <p>Any idea where does this come from ? related to hmr or webpack ?</p>
  
  <p>Edit:
  I've try to initialize socketIO own server
  Server side:</p>
  
  <pre><code>var server = app.listen(process.env.PORT || 3000 , function() {
          var host = server.address().address;
          var port = server.address().port;
          console.log('App listening at http://%s:%s', host, port);
      });
      var ioServer = http.listen(process.env.PORT || 9090 , function() {
          var host = ioServer.address().address;
          var port = ioServer.address().port;
          console.log('IO listening at http://%s:%s', host, port);
      });
  </code></pre>
  
  <p>Client side:</p>
  
  <pre><code>var socket = io.connect('http://127.0.0.1:9090');
  </code></pre>
  
  <p>But it's the same result "a user connected" heavy spam. Hundreds of connection to io. </p>