title: Socket.io Error on server
body: <p>I am tried to use socket io on the live server and I got this error.</p>
  
  <pre><code>polling-xhr.js:264 GET http://sub.domain.com:3000/socket.io/?EIO=3&amp;transport=polling&amp;t=MFUVMS5 net::ERR_TIMED_OUT
  </code></pre>
  
  <p>But on my local server, the files worked perfectly. I am working with socket.io and PHP.</p>
  
  <p>Here are my codes:</p>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>var socket = require('./node_modules/socket.io');
  var express = require('./node_modules/express');
  var app = express();
  var server = require('http').createServer(app);
  var io = socket.listen(server);
  var port = process.env.PORT || 3000;
  
  // server active console view
  server.listen(port, function () {
      console.log('Server listening at port %d', port);
  });
  
  io.on('connection', function (socket) {
  
      // show new added online user
      socket.on('now_online', function (data) {
          io.sockets.emit('now_online',{
              id: data.id,
              name: data.name
          });
      });
  });
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>var socket = io.connect('http://'+window.location.hostname+':3000');
  socket.on('new_online_user', function (data) {
      if (login_id != data.online_user) {
          $('#contacts-list .contact[data-chat='+data.online_user+']'+' .contact-status').addClass('online');
      }
  });
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "private": true,
    "dependencies": {
      "gulp": "^3.9.1",
      "express": "^4.16.2",
      "socket.io": "^2.0.4"
    }
  }
  </code></pre>
  
  <p>I was searching in google and StackOverflow about this issue but those solved didn't work for me.</p>
  
  <p>Thanks so much.</p>