-
Notifications
You must be signed in to change notification settings - Fork 24
Add the ability to subscribe to presence channels only, without their main counterparts #217
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
Conversation
5252f69 to
761f108
Compare
… main counterparts
761f108 to
abed187
Compare
…es from the String extension public
parfeon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good!
| /// Names of all subscribed main channels | ||
| /// | ||
| /// This list does not include presence channel names | ||
| var mainChannelNames: [String] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds a bit strange... channelNames(_ withPresence: Bool)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense 👍 It's much more readable, I'll change it to your suggestion
| let channelsWithPresence = channels.filter { $0.isPresenceChannelName }.map { PubNubChannel(channel: $0) } | ||
| let channelsWithoutPresence = channels.filter { !$0.isPresenceChannelName }.map { PubNubChannel(channel: $0) } | ||
| let channelGroupsWithPresence = channelGroups.filter { $0.isPresenceChannelName }.map { PubNubChannel(channel: $0) } | ||
| let channelGroupsWithoutPresence = channelGroups.filter { !$0.isPresenceChannelName }.map { PubNubChannel(channel: $0) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have separate lists for with and without presence channels? We have separate variables and then aggregate them later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the legacy subscription mechanism I would like to finally remove, but unfortunately, we have to still keep it for backward compatibility. Anyway, I will provide an updated version for that
| let channelsToUnsubscribe = channels.flatMap { $0.isPresenceChannelName ? [$0] : [$0, $0.presenceChannelName] } | ||
| let channelGroupsToUnsubscribe = channelGroups.flatMap { $0.isPresenceChannelName ? [$0] : [$0, $0.presenceChannelName] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But presence channels won't be used for actual unsubscribe REST API, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! And also, Presence channels won't be sent as parameters for join/leave events, but their "main" counterparts instead
|
@pubnub-release-bot release as 9.3.0 |
9f7c44d to
1c137df
Compare
1c137df to
39c5404
Compare
|
🚀 Release successfully completed 🚀 |
feat(subscribe): add the ability to subscribe to presence channels only, without their main counterparts