title: Including Socket.io on the client-side
body: <p>I've been spending all day working on my first app incorporating socket.io with Node and Express and I cannot seem to locate my <code>socket.io.js</code> file on the client side. I've read many SO questions and other forums about this issue, but can't seem to get mine to work with any of the recommended solutions.</p>
  
  <p>I have installed express and socket.io successfully and everything is working fine on the server side (currently just got it working with the Twitter Stream Api). Now that I want to use the data from <code>emit</code> on the client side I need to include my socket file.</p>
  
  <p>I've got HoganJS setup as my view engine. </p>
  
  <p>Here is an excerpt from my <code>app.js</code> file:</p>
  
  <pre><code>app.set('port', process.env.PORT || 3000);
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'hjs');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser('your secret here'));
  app.use(express.session());
  app.use(app.router);
  app.use(require('less-middleware')({ src: path.join(__dirname, 'public') }));
  app.use(express.static(path.join(__dirname, 'public')));
  </code></pre>
  
  <p>I have another file called <code>index.js</code> which is where my twitter and socket code is,here is my require lines:</p>
  
  <pre><code>var twitter = require('ntwitter');
  var io = require('socket.io').listen(3001, {log: false});
  // all my twitter setup/functions etc here
  io.sockets.emit('tweets' ,data);
  </code></pre>
  
  <p>Now on the client side, I've tried every possible path I can think of including:</p>
  
  <pre><code>&lt;script src="localhost:3000/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script src="socket.io/socket.io.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>And many other paths trying to figure out how to link it in properly. I'm terribly sorry if this is obvious or answered elsewhere, but I couldn't find it.</p>
  
  <p>Any path I can come up with results in a 404 according to chrome dev tools.</p>
  
  <p>Thanks so much! </p>