Experimental: Feedhose instant RSS protocol support for Node.js
JavaScript CoffeeScript Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
extras
public
vendor
.gitignore
.gitmodules
README.md
feedhose.coffee
feednozzle
ubuntu-install
utilities.coffee

README.md

WARNING: This is a hack in progress. Some assembly required.

node-feedhose is an experimental client for Dave Winer's feedhose protocol. See Feedhose -- a firehose for feeds and RSS data in JSON format for details. Why feedhose? It's roughly the same idea as PubSubHubBub, but instead of notifying you when an RSS feed changes (so you can download and reparse the entire thing), it just sends you the changed items as JSON.

What's here:

  • feedhose.coffee: An experimental protocol library for [Node.js][node], written using CoffeeScript.
  • feednozzle: A Socket.IO-based server.
  • public/index.html: A Socket.IO-based web client.

Why do I use Socket.IO to talk to the browser, and not the regular feedhose protocol? Basically, long-polling has some issues with certain browsers and firewalls, and Socket.IO offers a dead-simple API that deals with all those headaches. It also works with mobile phones, or so I hear.

Installing on Ubuntu

First, you'll need an Ubuntu 10.10 box, or something reasonably similar. I'm using an EC2 t1.micro image running Ubuntu 10.10 ami-508c7839. This costs me about 2 cents/hour. Feel free to run a bigger instance--it will definitely take less time to install Node.js.

First, open up ports 8000 and 843 on your EC2 security group. The latter is needed to serve up some Flash policy files used as a fallback by Socket.IO.

Next, install git, clone this repository, and run the install script:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git
git clone git://github.com/emk/node-feedhose.git
cd node-feedhose
./ubuntu-install

This will instruct you on how to proceed.

Making it robust (optional!)

Set up upstart and monit. This is very Ubuntu-specific.

sudo apt-get install monit
sudo cp extras/feednozzle.conf.upstart /etc/init/feednozzle.conf
sudo cp extras/feednozzle.monit /etc/monit/conf.d/feednozzle

These configuration files will serve on port 80, not 8000, so be sure to update your EC2 security group to allow traffic on port 80.

Next, edit /etc/monit/monitrc to taste. 10 second checks are fine. You may now start your server and your monitor process.

sudo start feednozzle
sudo /etc/init.d/monit start

Note that I haven't made any attempt to rotate logs or otherwise act as a well-behaved daemon yet. This is an exercise for another day.

What's this "coffee" stuff, anyways?

CoffeeScript is a preprocessor for JavaScript. I use it for several files in node-feedhose. Thanks to CoffeeScript, I don't need spend quite so much time writing ugly function () { prefixes, and I can declare classes without nearly so much boilerplate code. Go look at the pretty examples.

I haven't decided whether to translate node-feedhose to regular JavaScript.