Repository navigation
Send a leave request on unsubscribe with the default asyncio client - #244
Merged
Merged
Conversation
The event engine subscription manager, the default for PubNubAsyncio, sent a leave request only when enable_presence_heartbeat was on. A default client therefore stayed an occupant of the channel until the presence timeout, and suppress_leave_events=False (the default) had no effect. The threaded and legacy asyncio managers send the leave unless suppress_leave_events is set. Send it directly when the presence engine does not, skip -pnpres channels and empty operations, and keep suppress_leave_events working. Add offline unit tests and a live test that checks here_now after the unsubscribe. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
It needs a keyset that lists a client as an occupant when it subscribes without presence heartbeats. The keysets of the CI run do not, so the test failed there although the change works (it passes on a keyset with that presence setting). The offline unit tests cover the change on any keyset. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jguz-pubnub
approved these changes
Nov 23, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
@pubnub-release-bot release |
Contributor
|
🚀 Release successfully completed 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix(asyncio): send a leave request when unsubscribing with the default client
Unsubscribing with the default
PubNubAsyncioclient now sends a leave request unlesssuppress_leave_eventsis set, as the threaded and legacy asyncio subscription managers already do. The event engine subscription manager used to send it only whenenable_presence_heartbeatwas on, so the user ID stayed an occupant of the channel until the presence timeout and the other subscribers did not receive itsleavepresence event.test: add offline unit tests for the leave request on unsubscribe