Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

return amount of subscribers received the published message #2

Open
wants to merge 2 commits into from

1 participant

@dmitryuv

Redis returns amount of subscribers received the message, in some cases
it's essential to have it so I don't see a reason to hide return value
in wrapper.

dmitryuv added some commits
@dmitryuv dmitryuv return amount of subscribers received the published message
Redis returns amount of subscribers received the message, in some cases
it's essential to have it so I don't see a reason to hide return value
in wrapper.
c95bac4
@dmitryuv dmitryuv fix for publish commit 7250c89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 15, 2012
  1. @dmitryuv

    return amount of subscribers received the published message

    dmitryuv authored
    Redis returns amount of subscribers received the message, in some cases
    it's essential to have it so I don't see a reason to hide return value
    in wrapper.
  2. @dmitryuv

    fix for publish commit

    dmitryuv authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 index.js
View
9 index.js
@@ -63,11 +63,18 @@ exports.attach = function (options) {
amino.publish = function () {
var args = Array.prototype.slice.call(arguments)
, ev = args.shift()
+ , cb = args.pop();
+
+ if(typeof cb != 'function') {
+ if(typeof cb!=='undefined')
+ args.push(cb); // don't push empty values
+ cb = function(){};
+ }
try {
args = {args: args}; // (dehydration only works on objects)
args = hydration.dehydrate(args);
- client.publish(ev, JSON.stringify(args));
+ client.publish(ev, JSON.stringify(args), cb);
}
catch (e) {
amino.emit('error', e);
Something went wrong with that request. Please try again.