Skip to content

Commit

Permalink
Cleanup and removal of some debugging output.
Browse files Browse the repository at this point in the history
  • Loading branch information
eculver committed Jan 17, 2011
1 parent 2c50708 commit 92785cc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions bin/server.js
Expand Up @@ -17,23 +17,22 @@ var POLL_INTERVAL = 10000;
// our news object that we'll diff against
var shared_news_obj = [];

// grabs news from unofficial HN API (http://api.ihackernews.com)
// and fires the 'new_news' event.
function get_news() {
sys.puts("fetching news...");

request({uri:'http://api.ihackernews.com/page'}, function (error, response, data) {
if (!error && response.statusCode == 200) {

//sys.puts("response:");
//sys.puts(data);

var news_obj = JSON.parse(data);
if(news_obj.items && news_obj.items.length > 0) {
// diff the two to see if anything new has shown up.
// TODO: diff the two to see if anything new has shown up as
// opposed to just firing the event blindly.

sys.puts("found some news! (" + news_obj.items.length + ")");
sys.puts("found some news!");
news_emitter.emit('new_news', news_obj.items);


}
else {
sys.puts("couldn't find news :(");
}
}
});
Expand Down Expand Up @@ -61,7 +60,7 @@ socket.on('connection', function(client){

// New news callback/listener. Send it when we see it.
var handleNews = function(news) {
sys.puts("sending message...");
//sys.puts("sending message...");

// Give the message a type, so the FE can act on various different
// messages should the need arise.
Expand Down

0 comments on commit 92785cc

Please sign in to comment.