Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for subscription with presence channels #393

Merged
merged 4 commits into from
Jul 23, 2024
Merged

Support for subscription with presence channels #393

merged 4 commits into from
Jul 23, 2024

Conversation

mohitpubnub
Copy link
Contributor

@mohitpubnub mohitpubnub commented Jul 22, 2024

fix: fix issue with unsubscribe call when presence channels included manually.

Resolves the issue of manually included presence channels not being unsubscribed from the subscription set.

Closes #390

Comment on lines +34 to +43
channels.forEach((c) => {
const subscription = this.pubnub.channel(c).subscription(this.options);
this.channelNames = [...this.channelNames, ...subscription.channels];
this.subscriptionList.push(subscription);
});
channelGroups.forEach((cg) => {
const subscription = this.pubnub.channelGroup(cg).subscription(this.options);
this.groupNames = [...this.groupNames, ...subscription.channelGroups];
this.subscriptionList.push(subscription);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this cause trouble? Subscription object will give regular and -pnpres channels if it will be required by options.
I would expect that the required set of channels / groups (with presence channels) will be stored in channelNames and groupName when the filter will be back. Or it didn't work as expected with filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now channelNames, groupNames have all required channels and groups.

When filter will be back then -pnpres channels will be filtered out and the same backward compatibility issue will arise.

It will be problem if User provides -pnpres channel names along with receivePresenceEvents: true
And so we do not recommend it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, we may end up with a pretty bad situation. If people use a new approach, should we ask them not to set presence channels directly? On the other hand, sometime it is the only way to subscribe only to presence events.

Copy link
Contributor Author

@mohitpubnub mohitpubnub Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we ask them not to set presence channels directly?

That was the intention with current implementation. That user should not be worried about appending suffix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, sometime it is the only way to subscribe only to presence events.

Need to figure out the use case for it.

@parfeon parfeon changed the title fix:support for subscription with presence channels Support for subscription with presence channels Jul 23, 2024
@parfeon parfeon self-requested a review July 23, 2024 12:38
Copy link
Contributor

@parfeon parfeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Signed-off-by: Serhii Mamontov <[email protected]>
@parfeon
Copy link
Contributor

parfeon commented Jul 23, 2024

@pubnub-release-bot release

@parfeon parfeon merged commit 44f9d6c into master Jul 23, 2024
7 checks passed
@parfeon parfeon deleted the FIX-SUB branch July 23, 2024 13:10
@pubnub-release-bot
Copy link
Contributor

🚀 Release successfully completed 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Sets doesn't unsubscribe from channels with -pnpres suffix
3 participants