Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
$ npm install mongodb
Subscribe:
$ node subscribe.js
Publish:
$ mongo
> use pubsub
> db.messages.insert({ message: 'Hello world', time: Date.now() })
hey, I've turned this gist into a module: https://gist.github.com/xaiki/4722178
would you consider uploading it to npm ?