Skip to content

Commit

Permalink
fixed channels not reporting as unsubscribed after lost network conne…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
Callum Oakley committed Nov 29, 2016
1 parent a2deac1 commit 79271e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/channels/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class Channel extends EventsDispatcher {

/** Sends a subscription request. For internal use only. */
subscribe() {
if (this.subscribed) { return; }
this.subscriptionPending = true;
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, (error, data)=> {
Expand Down
3 changes: 3 additions & 0 deletions src/core/pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export default class Pusher {
this.global_emitter.emit(params.event, params.data);
}
});
this.connection.bind('connecting', ()=> {
this.channels.disconnect();
});
this.connection.bind('disconnected', ()=> {
this.channels.disconnect();
});
Expand Down

0 comments on commit 79271e2

Please sign in to comment.