Repository navigation
fix(android): isolate realtime connections by client - #2139
Merged
Merged
Conversation
🟢 Tier S · Ready to mergeAndroid realtime connections are now lazily owned by each Latest changes: The latest commits convert the isolation scenario into a dedicated JUnit test with direct assertions, update both Android harnesses to copy and run it, and remove the former stdout success-marker expectation.
📂 Walkthrough · 7
Reviewed the commits since |
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.
Two Android
Clientobjects currently share realtime state through a companion object. Subscribing on a second backend can send its subscription over the first backend’s socket, and lifecycle operations affect subscriptions belonging to other clients.Give each
Clientone lazily initialized realtime connection.Realtimewrappers around the same client reuse that connection; separate clients own independent sockets, subscriptions, presence, heartbeat, reconnect state and callbacks. Public wrappers retain independent coroutine scopes so cancelling one cannot permanently disable its client’s connection. The existing subscription overloads remain available.Realtime handshakes now read the JWT header configured by
setJWT(). The previous config lookup usedjwt, while that setter stores the config entry underjWT, so it omitted the configured JWT.Regression coverage uses real WebSocket backends and public SDK APIs. It checks different endpoints, different JWTs on the same endpoint/project, same-client wrapper reuse, presence, error/close callbacks, reconnection, disconnect isolation, and cancellation followed by wrapper recreation. Isolation is a dedicated JUnit test with direct assertEquals/assertTrue assertions, executed by both Android language E2E harnesses, including the R8-shrunk build. It does not print or compare a success marker.
Validation:
second backend must receive its own subscription: expected b, got a.Addresses appwrite/sdk-for-android#102. Regenerate and release the Android SDK after merging to deliver the fix to applications.
Related: appwrite-labs/cloud#6667