Fixed presence events member_added
and member_removed
not triggering for iOS
#12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! Thanks for this library, using it with authenticated private and presence channels.
While using it, I stumbled upon an issue in iOS where it doesn't trigger the
pusher:member_added
andpusher:member_removed
events at all with the presence channels. Making it impossible for the presence on iOS to know who joined or left.Fixing that in this PR because it was never being triggered in Flutter for iOS and wanted to fix that to make it work.
The change made is that it uses the
onMemberAdded
andonMemberRemoved
which the Pusher Swift SDK describes to register for these callbacks (see https://github.com/pusher/pusher-websocket-swift#swift-12).Next, the event is published with the same name as we expect to the Flutter side, as done with the other events.
This fixes the issue where the
pusher:member_added
andpusher:member_removed
events are not being triggered.When looking at the issues on the repo, I saw that #2 is facing the same issue in the first part of the issue. So this will also fix the first part of #2.
Summary
pusher:member_added
andpusher:member_removed
usage when using presence channelsAdditional note (Also related to #2)
However, the data send with the
pusher:subscription_succeeded
event differs much from Android (except for theuser_id
). That is another issue, and matches to the second part of #2, the 'improvement' that is suggested there.I was also facing this issue when parsing the messages on Android. Currently still parsing the data manually in Flutter to fix this inconsistency.