Appwrite handles push targets as user based. The biggest issue the situation where to cant trigger delete_push_target like user deletes an app and reinstalls. Currently am handling push_targets by assigning ID same as session ID so when user logs out i also delete his/her push. But when user deletes an app then i cant delete that push, so the database will be full of targets with expired tokens. Also i cant assign userID to because a user can login to multiple devices. Whats the best way to handle push targets?
#Push Target Handling
11 messages · Page 1 of 1 (latest)
My suggestion is to allow us to assign target_id to UDID. also allow overrides of targets where by if user logouts and logins with another account. then the target is overriden to a new user account.
@forest wyvern i planned to ask this in office hours but i missed it.
If a push target is invalid, it'll be marked for deletion: https://github.com/appwrite/appwrite/blob/92cb3ddcc6ff8b024a9b0ae4801f2bc4b5a3c99b/src/Appwrite/Platform/Workers/Messaging.php#L276
When a user logs out, all related push targets are deleted: https://github.com/appwrite/appwrite/blob/92cb3ddcc6ff8b024a9b0ae4801f2bc4b5a3c99b/app/controllers/api/account.php#L469
okay thats great. i wanted to ask when i subscribe to a topic, is it the user subscribing or target subscribing?
the reason i asked is the about the isssue of handling followers and folllowing with topics. i subscribe to a topic with the target then if i login in two devices then one device will be following and another not following the topic
You add targets to a topic, not users
You can add the target of the other device, right? What's the problem?
if you are handling topics as followers then its weird for the user to follow something twice
for example if you treat topics as channel for users to follow. if the user follows a certain channel. he/she expects to be following it even on the second device that he/ she has logged in