Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] Sets doesn't unsubscribe from channels with -pnpres suffix #390

Closed
roman-rr opened this issue Jul 12, 2024 · 3 comments · Fixed by #393
Closed

[BUG] Sets doesn't unsubscribe from channels with -pnpres suffix #390

roman-rr opened this issue Jul 12, 2024 · 3 comments · Fixed by #393
Labels
status: done This issue is considered resolved.

Comments

@roman-rr
Copy link

Please correct me, if not the bag.

// Let's define a subscription set and add some channels with `-pnpres` for presence listening. 
let regularSubscriptionSet = pubnub.subscriptionSet({
  channels: ['channel-1-pnpres', 'channel-2-pnpres', 'channel-3', 'channel-4'],
});

// Subscribe to set
regularSubscriptionSet.subscribe();

// Check subscriptions
console.log('Subscribed channels', pubnub.getSubscribedChannels());
// Returned ['channel-1-pnpres', 'channel-2-pnpres', 'channel-3', 'channel-4']

// Unsubscribe from set 
regularSubscriptionSet.unsubscribe();

console.log('Subscribed channels', pubnub.getSubscribedChannels());
// Returned ['channel-1-pnpres', 'channel-2-pnpres']

// Call depreciated method
pubnub.unsubscribe({channels: ['channel-1-pnpres', 'channel-2-pnpres']})

console.log('Subscribed channels', pubnub.getSubscribedChannels());
// Returned []

In other words, new SubscriptionSet functionality doesn't unsubscribe from channels with -pnpres, even it's bootstrapped to pubnub.channel().
Old style pubnub.unsubscribe() works as expected.

Did I miss something?

@parfeon
Copy link
Contributor

parfeon commented Jul 12, 2024

@roman-rr thank you for reporting back about the issue.

I can see in the code special -pnpres channels treatment, but need to consult the team about why this decision has been made. It should list of channels and groups as-is, but maybe some factors need to be considered.

@pubnub-release-bot
Copy link
Contributor

@roman-rr this issue is addressed in v8.2.6

@github-actions github-actions bot added the status: done This issue is considered resolved. label Jul 23, 2024
@parfeon
Copy link
Contributor

parfeon commented Jul 23, 2024

Release is rolling out as a temporarily backward-compatible solution.

The idea behind the original implementation was to use the receivePresenceEvents subscription configuration option to instruct the subscription object to provide -pnpres - this way all works as expected. When they have passed manually, you will get into trouble.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: done This issue is considered resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants