Repository navigation
feat(messaging): Appwrite user push without a device target - #13876
Merged
Merged
Conversation
The Appwrite push provider delivers to a user's reserved MQTT topic (users/<userId>) that the user subscribes to with their session, so a device target is meaningless. When the push provider is Appwrite, a users[] campaign now addresses each user id directly and auto-provisions the topic on publish, instead of walking the targets collection. Other push providers still resolve device targets as before. DX: receiving a per-user push no longer requires account.createPushTarget — the client just subscribes to users/<its id> over MQTT and the server sends users: [id].
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Addresses review on the target-free user push: - No longer skips the targets query when Appwrite is the default provider, so a user's FCM/APNS targets still receive; the reserved users/<id> topic is additive, used only for existing users that have no registered target. - Validates that each users[] id exists before publishing, so a bogus id can't create a phantom users/ topic or be counted as delivered.
groupTargetsByProvider drops expired targets, so marking a user reached on an expired target wrongly excluded them from the direct users/<id> delivery — an expired-only user got nothing. Only non-expired targets now count as reached.
HarshMN2345
approved these changes
Sep 24, 2026
This was referenced Oct 8, 2026
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.
What
For the built-in Appwrite push provider, delivering a per-user notification no longer requires a device push target. A
users: [userId]campaign now delivers straight to the user's reserved MQTT topicusers/<userId>— the same topic the user subscribes to with just their session.Follow-up to #13860 (reserved per-user topics), now merged.
Why
The Appwrite/MQTT provider delivers over the broker, where the MQTT subscription is the registration — there is no device token to store. Yet the old flow still forced developers to:
account.createPushTarget(id, token)— with a required device token that this provider never reads, andusers: [userId]silently resolved to zero recipients (no error).So a user could successfully subscribe to
users/<their id>and still receive nothing unless a dummy target was registered first — a confusing, asymmetric DX.What changed
Messagingworker (streamRecipients): when the push provider isappwrite, theusers[]param addresses each user id directly (users/<userId>, chunked) instead of walking thetargetscollection. The topic auto-provisions on first publish (as in Reserved topics for users #13860). Every other push provider (FCM/APNS) still resolves device targets unchanged.topics[]andtargets[]paths are untouched.New DX
Tests
testUserTopicReceivesUserTargetedPushupdated: creates only an enabled Appwrite provider (no push target), subscribes tousers/<id>, sendsusers: [id], and asserts receipt.