title: Pusher subscribe and un-subscribe process
body: <p>I'm getting a Pusher subscribe/un-subscribe problem with presence groups on a fairly simple chat application.  There should be two subscribed channels at a given time. Users switch between channels when navigating between backbone routes, so there are no hard page reloads.</p>
  
  <p>Pusher appears to function most of the time, but I get intermittent errors for channel subscriptions.</p>
  
  <p>I wrote two join channel methods that unsubscribe if one has been joined by a previous route.  I'm worried that there is something async happening within Pusher that is breaking things.</p>
  
  <p>My pusher related code for a single channel:</p>
  
  <pre><code>window.pusher = new Pusher('&lt;%= Pusher.key %&gt;', {
    authEndpoint: 'api/pusher/auth'
  });
  </code></pre>
  
  <p>Route:</p>
  
  <pre><code>this.groupFeed = this._pusherSubscribeGroup(group_id);
  this.groupFeed.bind('new_conversation', function(data) {
    var newConv = new App.Models.Conversation(data);
    this.group.conversations().add(newConv);
  }.bind(this));
  </code></pre>
  
  <p>Unsubscribe helper:</p>
  
  <pre><code>_pusherSubscribeGroup: function (group_id) {
    if (this._groupChannelName) {
      window.pusher.unsubscribe(this._groupChannelName);
    }
    this._groupChannelName = 'presence-group-' + group_id;
    return window.pusher.subscribe(this._groupChannelName);
  }
  </code></pre>
  
  <p>Console error:</p>
  
  <pre><code>Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Existing subscription to channel presence-group-1"}}}
  </code></pre>