pubnub / pubnub-angular2

Other
33 stars 13 forks source link

Issue with subscribing after unsubscribeAll() #38

Open sunu-xminds opened 4 years ago

sunu-xminds commented 4 years ago

The initial subscription works fine for me in my use case. But in my application when a person logs out I have to unsubscribe all the subscriptions, for which I used unsubscribeAll() method. When the person logs in again, I am again calling the subscribe method to, get the listeners live. But its not working.

initListener(user) {
    const channel = `chanelName`;
    this.pubnub.subscribe({
      channels: [channel],
      withPresence: true,
      autoload: 100,
      triggerEvents: ["message", "presence", "status"]
    });
    const history = this.pubnub.getMessage(
      channel,
      this.handleMessageReceived.bind(this)
    );
  }

This is how I subscribe to channel and this.pubnub.unsubscribeAll(); this is how I unsubscribe everything.

Am I doing something wrong here?