Realtime notifications with Redis and Node.js
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
.travis.yml
LICENSE.md
README.md
package.json

README.md

Rodeo

Realtime notifications with Redis and Node.js

Build Status

Installation

npm install rodeo

Usage

var rodeo   = require('rodeo');

rodeo.on('message', function (notice) {
    // Do something else!
});

rodeo.listen({}, function (err) {
    // Listening for messages... now let's submit a new message
    rodeo.submit({
        target:     'user::1234',
        persist:    true,
        message:    'Hello world!'
    }, function (err) {
        // It worked!
    });
});

Notice Model

Notices follow a very simple convention allowing for arbitrary extension through the "message" object:

{
    "id": "beb62c35-252e-44ec-9083-fd44a1e51a9f",
    "stamp": "2012-08-13T15:06:40.097Z",
    "read": false,
    "persist": false,
    "target": "test::1234",
    "message": "Hello World"
}
{
    "id": "beb62c35-252e-44ec-9083-fd44a1e51a9f",
    "stamp": "2012-08-13T15:06:40.097Z",
    "read": true,
    "persist": false,
    "target": "test::1234",
    "message": {
        "foo": "bar",
        "nyan": "cat",
        "country": {
            "music": "rules"
        }
    }
}

CLI

Rodeo includes a command line interface which makes testing a bit simpler:

[sudo] npm install -g rodeo
cat message.json | rodeo --target 'test::1234' --persist

To use the CLI with non-default redis connection settings. Simply set the RODEO_CLI_HOST, RODEO_CLI_PORT, and (optionally) RODEO_CLI_PASS environment variables.

Testing

npm test