Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ The pattern uses asterisks (*) for matching.

Publishing to a feed adds an item to the end of the feed, sorted by publish time.

feed.publish('item contents', 'optional id', function(item, id) {
feed.publish('item contents', 'optional id', function(err, item, id) {
//done publishing!
});

Expand All @@ -174,7 +174,7 @@ structure by only working the IDs and not with the item contents.
Removing an item is done through retraction, which simply requires the ID of the
item to remove.

feed.retract('item id', function(id, error) {
feed.retract('item id', function(err, id) {
//success?
});

Expand Down
14 changes: 10 additions & 4 deletions thoonk.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Feed = exports.Feed = require("./feed.js").Feed,
* @param host
* @param port
*/
var Thoonk = exports.Thoonk = function Thoonk(host, port, db) {
var Thoonk = exports.Thoonk = function Thoonk(host, port, db, password) {
host || (host = "127.0.0.1");
port || (port = 6379);
db || (db = 0);
Expand All @@ -31,9 +31,15 @@ var Thoonk = exports.Thoonk = function Thoonk(host, port, db) {
EventEmitter.call(this);
this.setMaxListeners(100000);
this.lredis = redis.createClient(port, host);
if (typeof password != 'undefined') {
this.lredis.auth(password);
}
this.lredis.select(db);
this.lredis.subscribe("newfeed", "delfeed", "conffeed");
this.mredis = redis.createClient(port, host);
if (typeof password != 'undefined') {
this.mredis.auth(password);
}
this.mredis.select(db);
this.lock = new padlock.Padlock();

Expand Down Expand Up @@ -471,10 +477,10 @@ Thoonk.prototype.getFeedNames = function(callback, error_callback) {
* Shortcut function to make creating a Thoonk instance
* easier, as so:
*
* var pubsub = require("thoonk").createClient(host, port, db);
* var pubsub = require("thoonk").createClient(host, port, db, password);
*/
exports.createClient = function(host, port, db) {
return new Thoonk(host, port, db);
exports.createClient = function(host, port, db, password) {
return new Thoonk(host, port, db, password);
}

exports.VERSION = '0.5.1';