Replies: 1 comment 1 reply
-
You'll be hard pressed to find a codebase online that does all of that. Fcm token handling is very project specific, and some of these suggestions certainly aren't needed for every project. I recently open-sourced my closed down startup, and I think we had some pretty clean and scalable code for fcm token handling. But, before you look at it, like i said, it doesn't do everything in this list since not everything is necessary. So, we don't update tokens every month: we update them on the backend every time there's a token change locally (which can happen more often than monthly). We also don't really use topic subscriptions: only tokens were good enough for us. Lastly, we don't have a ttl for tokens to remove them after 2 months. Rather, we remove all tokens that can no longer be used to send notifications (which means something (but not necessarily age) has made that token invalid). Here's the code for a lot of the core fcm handling functions on the backend And heres where a lot of the client side fcm handling is done (executed on every fresh launch of the app, as long as the user is logged in) There's a lot of app-specific things done on the client side, but I'd actually say the server side is pretty clean so it should be easy to understnad. I also took the pain to make sure this part of my project is well commented since fcm is not fun to re-learn. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The "Best practices for FCM registration token management" document suggests several things to implement:
Is there a reference implementation or some open source project that implements all this? (e. g. using firestore as the backend)
Beta Was this translation helpful? Give feedback.
All reactions