Skip to content

fix: replace presence users on resubscription - #383

Open
pcbeingused333 wants to merge 1 commit into
pusher:masterfrom
pcbeingused333:fix/presence-snapshot-c2198
Open

pcbeingused333 wants to merge 1 commit into
pusher:masterfrom
pcbeingused333:fix/presence-snapshot-c2198

Conversation

@pcbeingused333

Copy link
Copy Markdown

Fixes #299

Presence channels are reused when reconnecting, but subscription snapshots were added to the existing user map. Users who left during a disconnect therefore remained in getUsers() and onUsersInformationReceived.

Clear the previous membership before applying a successful presence snapshot. The existing missing-presence error path remains unchanged.

Two regression tests send successive subscription snapshots, covering a departed user and an empty replacement snapshot. Both check the stored membership and the users-information callback.

Testing and validation

The two new tests fail on master (expected:<1> but was:<2> and expected:<0> but was:<2>) and pass with the fix. With the patch, gradle test passes the full suite (325 tests) on Gradle 7.3 and JDK 17 in Docker. The 8 and 11 CI jobs were not run locally. The scenario was exercised through successive subscription events in unit tests, not against a live Pusher app.

This patch and its regression tests were prepared and tested with AI coding agents.

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.

Wrong presence channel behavior (Android/IOS)

1 participant