Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Only subscribe once to a channel #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 6 additions & 4 deletions app/assets/javascripts/private_pub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down