title: Socket.io server not listening to connection event
body: <p>i am pretty new to Node.js . I am using socket.io to build up a real time feed application.</p>
  
  <p>i am using <a href="http://socket.io/get-started/chat/" rel="nofollow noreferrer">http://socket.io/get-started/chat/</a> to get started with my application.
  in combination with express</p>
  
  <p>Following is my server code</p>
  
  <pre><code>/**
   * Module dependencies.
   */
  var express = require('express');
  var logger = require('morgan');
  var routes = require('./routes');
  var app = express();
  var http = require('http').Server(app);
  var io = require('socket.io')(http);
  
  // log requests
  app.use(logger('dev'));
  app.use('/rest', routes.userInfo, routes.matchList, routes.teamList,
          routes.completedMatchList);
  
  io.on('connection', function(socket){
        console.log('a user connected');
      });
  
  app.listen(3006);
  
  console.log('listening on port 3006');
  </code></pre>
  
  <p>Then i have an index.html inside my web folder of my application.</p>
  
  <p>I am just using plain code to intitalize the client socket as below</p>
  
  <pre><code> &lt;script src="/node_modules/socket.io/node_modules/socket.io-client/socket.io.js"&gt;&lt;/script&gt;     
  &lt;script&gt;
    var socket = io();
  &lt;/script&gt;
  </code></pre>
  
  <p>I started my server and its work well
  But even after the client page loads and is served, connection event is not listened and the code is not printing in the console "user is connected".</p>
  
  <p>Just to add a little bit, i use an application router in middle which starts at port 5000.</p>
  
  <p>i checked in the chrome console, it is constantly reporting errors like</p>
  
  <p><a href="http://localhost:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=LF2viiR" rel="nofollow noreferrer">http://localhost:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=LF2viiR</a></p>
  
  <p><a href="http://localhost:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=LF2vj0v" rel="nofollow noreferrer">http://localhost:5000/socket.io/?EIO=3&amp;transport=polling&amp;t=LF2vj0v</a></p>
  
  <p>Snapshot my chrome console with errors
  <a href="https://i.stack.imgur.com/NWrLp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NWrLp.png" alt="enter image description here"></a></p>
  
  <p>cheers,</p>
  
  <p>Saurav</p>