title: Browser can't get socket.io.js file using express
body: <p>I have problem with socket.io examples. My browser can't get socket.io.js file (404 error in console).</p>
  
  <p><br/>
  Code that work:</p>
  
  <p><em>server.js</em></p>
  
  <pre><code>var app = require('express').createServer()
    , io = require('socket.io').listen(81);
  
  app.listen(80);
  
  app.get('/', function (req, res) {
    res.sendfile(__dirname + '/index.html');
  });
  
  io.sockets.on('connection', function (socket) {
    socket.emit('news', { hello: 'world' });
    socket.on('my other event', function (data) {
      console.log(data);
    });
  });
  </code></pre>
  
  <p><em>index.html</em></p>
  
  <pre><code>&lt;script src="http://192.168.1.104:81/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('http://192.168.1.104:81');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p><br/>
  But this one not:</p>
  
  <p><em>server.js</em></p>
  
  <pre><code>var app = require('express').createServer()
    , io = require('socket.io').listen(app);
  
  app.listen(80);
  
  app.get('/', function (req, res) {
    res.sendfile(__dirname + '/index.html');
  });
  
  io.sockets.on('connection', function (socket) {
    socket.emit('news', { hello: 'world' });
    socket.on('my other event', function (data) {
      console.log(data);
    });
  });
  </code></pre>
  
  <p><em>index.html</em></p>
  
  <pre><code>&lt;script src="http://192.168.1.104:80/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('http://192.168.1.104:80');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>In this case my browser can't get socket.io.js file.</p>