@convex/expo-push-notifications sending notification to all registered tokens
Hi, in my app I want to send notification to all users that have registered for push notifications.
I noticed that there is a table 'pushTokens' table under pushNotifications component in the dashboard. I want to query this table from my mutation instead of querying all 'users', but I cant find any documentation for this.
Also, is it safe to call pushNotifications.sendPushNotification() like this for every registered token?
Does this component mind expo's send request and other limits? Documentation on this is very poor...
2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
As far as querying the pushTokens table instead of all users, the component uses an index, so it's scanning and reading either 0 or 1 documents. Bypassing and reading the table directly won't improve this.
Judging by the source, the 600 notification per second limit is not accounted for, so for now you'll want to handle limiting yourself if there's any risk of going over.
GitHub
expo-push-notifications/src/client/index.ts at cc9a70b92e7f8b9fd3b6...
Contribute to get-convex/expo-push-notifications development by creating an account on GitHub.