Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Commit

Permalink
move publishSubscriptions check out of callback
Browse files Browse the repository at this point in the history
  • Loading branch information
behrad committed Apr 16, 2016
1 parent 798fb0d commit 6a5cfa5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,29 +262,27 @@ function Server(opts, callback) {
);
});

that.on("subscribed", function(topic, client) {
if(that.modernOpts.publishSubscriptions) {
if(that.modernOpts.publishSubscriptions) {
that.on("subscribed", function(topic, client) {
that.publish({
topic: "$SYS/" + that.id + "/new/subscribes",
payload: JSON.stringify({
clientId: client.id,
topic: topic
})
});
}
});
});

that.on("unsubscribed", function(topic, client) {
if(that.modernOpts.publishSubscriptions) {
that.on("unsubscribed", function(topic, client) {
that.publish({
topic: "$SYS/" + that.id + "/new/unsubscribes",
payload: JSON.stringify({
clientId: client.id,
topic: topic
})
});
}
});
});
}

that.on("clientDisconnected", function(client) {
if(that.modernOpts.publishClientDisconnect) {
Expand Down

0 comments on commit 6a5cfa5

Please sign in to comment.