maccman/juggernaut — pull request #101 by Sephi-Chan (2011-10-13 19:19:20+00:00)
Title: Add singleton subscriptions

Sometime you need to have only one subscription to a channel, regardless the number of times you call `subscribe`. It may be useful when you subscribe in an AJAX callback.

``` Javascript
$(".user a.follow").live("click", function(event){
$.post(this.href, function(data, status, xhr){
var channel = "users/" + data.user.id + "/feed";
juggernaut.singleSubscribe(channel, function(feedEntry){
console.log("Got new feed entry: " + feedEntry);
}
});
});
```

Even if the user click many times to follow an user, each new messages of this users's feed will be pushed to the client only once.