javascript - Pusher subscribe and un-subscribe process -


i'm getting pusher subscribe/un-subscribe problem presence groups on simple chat application. there should 2 subscribed channels @ given time. users switch between channels when navigating between backbone routes, there no hard page reloads.

pusher appears function of time, intermittent errors channel subscriptions.

i wrote 2 join channel methods unsubscribe if 1 has been joined previous route. i'm worried there async happening within pusher breaking things.

my pusher related code single channel:

window.pusher = new pusher('<%= pusher.key %>', {   authendpoint: 'api/pusher/auth' }); 

route:

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)); 

unsubscribe helper:

_pushersubscribegroup: function (group_id) {   if (this._groupchannelname) {     window.pusher.unsubscribe(this._groupchannelname);   }   this._groupchannelname = 'presence-group-' + group_id;   return window.pusher.subscribe(this._groupchannelname); } 

console error:

pusher : error : {"type":"websocketerror","error":{"type":"pushererror","data":{"code":null,"message":"existing subscription channel presence-group-1"}}} 

pusher : error : {"type":"websocketerror","error":{"type":"pushererror","data":{"code":null,"message":"existing subscription channel presence-group-1"}}}

the message telling - far pusher service concerned - particular client identified socket_id subscribed presence-group-1 channel. point of view of client error normally isn't need worry about.

however, if user subscribing/unsubscribing navigating routes worth getting more information sure. supplied code , description, it's not possible determine if problem within pusher service or client application.

providing output of pusher javascript library logging provide more detail determine cause.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -