diff --git a/CHANGELOG.md b/CHANGELOG.md index fd6b87b..c17c641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## HEAD + +* Only subscribe once to a channel (thanks vollnhals) + ## 1.0.3 (August 20, 2012) * fixed Faye startup error (thanks gitt) - issue #40 diff --git a/app/assets/javascripts/private_pub.js b/app/assets/javascripts/private_pub.js index 8775ca3..1528171 100644 --- a/app/assets/javascripts/private_pub.js +++ b/app/assets/javascripts/private_pub.js @@ -47,10 +47,12 @@ function buildPrivatePub(doc) { if (!self.subscriptions.server) { self.subscriptions.server = options.server; } - self.subscriptions[options.channel] = options; - self.faye(function(faye) { - faye.subscribe(options.channel, self.handleResponse); - }); + if (!self.subscriptions[options.channel]) { + self.subscriptions[options.channel] = options; + self.faye(function(faye) { + faye.subscribe(options.channel, self.handleResponse); + }); + } }, handleResponse: function(message) {