title: nodejs socket.io express handshake error
body: <p>I try to create a real time app by socket.io.
  Server side:</p>
  
  <pre><code>var express = require('express');
  var io = require('socket.io');
  var engine = require('ejs-locals');
  
  var app = express()
      , server = require('http').createServer(app)
      , io = io.listen(server);
  
  app.engine('ejs', engine);
  app.set('view engine', 'ejs');
  
  app.get('/', function(req, res){
     res.redirect('/login')
  });
  
  app.use(express.static(__dirname + '/public'));
  
  app.listen(3001);
  
  io.sockets.on('connection', function (socket) {
      console.log('Client connected...');
      socket.on('send_login_data', function (data) {
          console.log(data);
      });
  });
  </code></pre>
  
  <p>Client side:</p>
  
  <pre><code>var socket = io.connect('http://localhost:3001');
      socket.on('connect_failed', function(){
          console.log('Connection Failed');
      });
      socket.on('connecting', function () {
          console.log('connecting...');
      });
  
      socket.on('connect', function () {
          console.log('connected!');
      });
  </code></pre>
  
  <p>I caught the next error:</p>
  
  <blockquote>
    <p>GET <a href="http://localhost:3001/socket.io/1/?t=1447539302809" rel="nofollow">http://localhost:3001/socket.io/1/?t=1447539302809</a> 404 (Not Found)</p>
  </blockquote>
  
  <p>As I understand, it's a handshake error. 
  How can I fix it?</p>
  
  <p>Thanx.</p>