title: Displaying streaming twitter on webpage with socket.io/node.js
body: <p>I'm trying to build a Twitter streaming web application using node.js socket.io and twit.</p>
  
  <pre><code>var express = require('express')
    , app = express()
    , http = require('http')
    , server = http.createServer(app)
    ,Twit = require('twit')
    , io = require('socket.io').listen(server);
  
  server.listen(8080);
  
  // routing
  app.get('/', function (req, res) {
    res.sendfile(__dirname + '/index.html');
  });
  
  var watchList = ['love', 'hate'];
  
  
  io.sockets.on('connection', function (socket) {
    console.log('Connected');
  
    var T = new Twit({
      consumer_key:         ''
    , consumer_secret:      ''
    , access_token:         ''
    , access_token_secret:  ''
  })
   T.stream('statuses/filter', { track: watchList },function (stream) {
  
    stream.on('tweet', function (tweet) {
  
          io.sockets.emit('stream',tweet.text);
          console.log(tweet.text);
  
    });
   });
  }); 
  </code></pre>
  
  <p>Here's my client side </p>
  
  <pre><code> &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"&gt;&lt;/script&gt;
    &lt;script&gt;
      $(function(){
        var socket = io.connect('http://localhost:8080');
        socket.on('tweet', function(tweet) {
      $(
          '&lt;div class="tweet"&gt;' + tweet.text + '&lt;/div&gt;');
          }); 
  
    });
  
    &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I run node app.js and try to connect to localhost:8080 I just get a blank page, even if everything ( soket.io, jquery, ... ) seems to have loaded correctly. </p>
  
  <p>Here's a sample of the server output : </p>
  
  <pre><code>info  - socket.io started
  debug - served static content /socket.io.js
  debug - client authorized
  info  - handshake authorized pwH0dbx4WvBhzSQXihpu
  debug - setting request GET /socket.io/1/websocket/pwH0dbx4WvBhzSQXihpu
  debug - set heartbeat interval for client pwH0dbx4WvBhzSQXihpu
  debug - client authorized for
  debug - websocket writing 1::
  debug - websocket writing 5:::{"name":"stream","args":["RT @mintycreative: Great to chat       today RT @SharonHolistic: Treatments available tomorrow http://t.co/5Poq3KU08u Book yours now #WestMidsHou…"]}
  </code></pre>
  
  <p>debug - websocket writing 5:::{"name":"stream","args":["RT @laurenpeikoff: #BREAKING @ScottsdalePD confirms - police are investigating Michael Beasley for alleged sexual assault. @12News @azcentr…"]}</p>
  
  <p>Hope you can help me to correct my mistakes.</p>