title: Socket.io code works locally, does not run on server
body: <p>My little game server works fine when run locally, but when I put it up on my linode I get errors.</p>
  
  <p>Full source: <a href="https://github.com/raimondi1337/null-terminus" rel="nofollow noreferrer">https://github.com/raimondi1337/null-terminus</a></p>
  
  <p>Relevent Server code:</p>
  
  <pre><code>var app = require('express')();
  var http = require('http').Server(app);
  var io = require('socket.io')(http);
  
  var clients = {};
  
  app.get('/', function(req, res){
    res.sendFile(__dirname + '/index.html');
  });
  
  http.listen(3000, function(){
    console.log('listening on *:3000');
  });
  </code></pre>
  
  <p>Relevant Client Code:</p>
  
  <pre><code>&lt;body&gt;
  &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;h3 id="#player"&gt;&lt;/h3&gt;
  &lt;canvas id="canvas" width="750" height="500"&gt;&lt;/canvas&gt;
  &lt;script&gt;var socket = io();
  </code></pre>
  
  <p>Run as is, I get:</p>
  
  <pre><code>GET http://staging.dustinraimondi.com/socket.io/socket.io.js 
  (index):8 Uncaught ReferenceError: io is not defined
  </code></pre>
  
  <p>If I change the socket.io script tag to the latest socket.io CDN I get : <code>socket.io-1.4.5.js:1 GET http://staging.dustinraimondi.com/socket.io/?EIO=3&amp;transport=polling&amp;t=LR3DCHp 404 (Not Found)</code></p>
  
  <p>If I change <code>io();</code> to <code>io.connect(23.239.8.165:3000);</code> as per <a href="https://stackoverflow.com/questions/11916999/socket-io-only-works-locally">Socket.IO only works locally</a> io is still undefined and the 'GET' fails. Same if I use 'io.connect();', same if I specify my server's IP and I use the socket.io CDN.</p>
  
  <p>What web concept am I not understanding here?</p>
  
  <p>EDIT: Socket.io is installed on the server via NPM, the server is running.</p>