title: TypeError: Cannot read property 'map' of undefined
body: <p>I am newbie to node.js I was trying to implement the <a href="http://blog.nodeknockout.com/post/34243127010/knocking-out-socket-io" rel="nofollow">example</a>. when i run <code>node app.js</code> i am getting map error which is given below:</p>
  
  <p><strong>Error</strong></p>
  
  <pre><code>oneadmin@openflow1:~/Desktop/test-projects/nodejs/example$ node app.js
     info  - socket.io started
  /home/oneadmin/Desktop/test-projects/nodejs/example/app.js:17
      io.sockets.emit('tweets', obj.results.map(function (v) { return v.text; })
                                           ^
  TypeError: Cannot read property 'map' of undefined
      at Request._callback (/home/oneadmin/Desktop/test-projects/nodejs/example/app.js:17:42)
      at Request.self.callback (/home/oneadmin/Desktop/test-projects/nodejs/example/node_modules/request/main.js:122:22)
      at Request.EventEmitter.emit (events.js:107:17)
      at Request.&lt;anonymous&gt; (/home/oneadmin/Desktop/test-projects/nodejs/example/node_modules/request/main.js:655:16)
      at Request.EventEmitter.emit (events.js:126:20)
      at IncomingMessage.&lt;anonymous&gt; (/home/oneadmin/Desktop/test-projects/nodejs/example/node_modules/request/main.js:617:14)
      at IncomingMessage.EventEmitter.emit (events.js:126:20)
      at _stream_readable.js:895:16
      at process._tickCallback (node.js:343:11)
  </code></pre>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>var sio = require('socket.io')
    , http = require('http')
    , index = require('fs').readFileSync(__dirname + '/index.html')
    , request = require('request')
  
  var app = http.createServer(function (req, res) {
      res.writeHead(200, { 'Content-Type': 'text/html' });
      res.end(index);
    })
    , io = sio.listen(app);
  
  setInterval(function () {
    request({
      url: 'http://search.twitter.com/search.json?q=today'
    }, function (err, res, data) {
      var obj = JSON.parse(data);
      io.sockets.emit('tweets', obj.results.map(function (v) { return v.text; }));
    });
  }, 2000);
  
  io.sockets.on('connection', function (socket) {
    socket.broadcast.emit('someone connected');
  
    socket.on('some event', function () {
      console.log('I got an event');
    });
  });
  
  app.listen(3000);
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt;&lt;/script&gt;
  
      &lt;script&gt;
        var socket = io.connect();
  
        $(function () {
          socket.on('tweets', function (tweets) {
            $.each(tweets, function (i, tweet) {
              $('#tweets').prepend($('&lt;li&gt;').text(tweet));
            });
          });
  
          socket.on('someone connected', function () {
            $('body').prepend('&lt;p&gt;Someone just connected!&lt;/p&gt;');
          });
  
          socket.emit('some event');
        });
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;Tweets&lt;/h1&gt;
      &lt;ul id="tweets"&gt;&lt;/ul&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any one help me to remove this error
  Thanks in advance!</p>