title: socket.io setinterval way
body: <p>I want to make a web page for give the client the news of his friends every 1 second using socket.io + node.js.</p>
  
  <p>My codes  : </p>
  
  <p><strong>Client :</strong></p>
  
  <pre><code>var socket = io.connect('http://localhost:port');
  socket.on('connect', function(){
      socket.emit('hello', 'Hello guest');
  });
  socket.on('news_by_server', function(data){
      alert(data);
  });
  setInterval(function(){
      socket.emit('news', 'I want news :D ');
  }, 1000);
  </code></pre>
  
  <p><strong>server:</strong></p>
  
  <pre><code>    var io = require('socket.io').listen(port);
      io.sockets.on('connection', function (socket) {
          socket.on('hello', function(data){
              console.log('new client connected');
          });
          socket.on('news', function(data){
              socket.emit('news_by_server', 1);
          });
      });
  </code></pre>
  
  <p>that's the mains codes, but my question is about the INTERVAL, is it good the make realtime news or there's a way better then it.</p>