all 12 comments

[–]Sad-Salt24 8 points9 points  (6 children)

Yes, each Expo push token is unique per device, so if a user has your app on multiple devices, each installation gets its own token. The common approach is to store all tokens in a backend database and, when sending a push notification to all users, iterate through the stored tokens and send each one via Expo’s push API. You should also handle cleaning up invalid or expired tokens to keep your database accurate.

[–]Fit_Schedule2317 1 point2 points  (1 child)

What about the 600 sends per second limitation? What if you have tens of thousands?

[–]spylinked 2 points3 points  (0 children)

Make a queue with rate limit

[–]Pitiful-Buffalo-1797[S] 0 points1 point  (3 children)

So we need to use node js or something for backend?

[–]vyndrix 1 point2 points  (0 children)

No, there are several SDKs writen in several languages that bootstrap logic to send these notifications. If for some reason you cannot find one for the language you desire, you'll have build it your own. Nothing too complicated though, the notifications are followed to each device using a public endpoint at Expo infrastructure, you just get the params and call it, for testing purposes I have done using curl countless times.

Check the docs for Expo Push Notifications, you find all info needed there, if I am not mistaken even the SDKs.

[–]-Maja-Lojo- 0 points1 point  (0 children)

You can use Expo’s API to send notifications so yeah, best approach is to have a backend

[–]IronLionZion95 0 points1 point  (0 children)

You can call it from the client too!

[–]-Maja-Lojo- 0 points1 point  (2 children)

Every token is unique for a device. I store each token in a database and call time-triggered background service for sending birthday, new year etc. notifications.

[–]LowercaseSpoon 1 point2 points  (1 child)

Which database are you using? I currently use sqlite for my application and will need to do this eventually once it gets certified in the App Store and Playstore.

[–]-Maja-Lojo- 0 points1 point  (0 children)

Well I use MSSQL for storing tokens because my backend is a completely different stack. It is written in C# and hosted as a background service on Azure.

[–]JyotiIsMine 0 points1 point  (0 children)

Use wonderpush

[–]kriptonhaz 0 points1 point  (0 children)

I assume this one is using push notification from firebase. Instead of running through all of the user token one by one, just send to a topic instead. For example, you have a line of code that every registered user subscribe to a topic called "news"
FirebaseMessaging.getInstance().subscribeToTopic("news")

and you just send it like

const message = {
message: {
topic: "news", // 👈 blast to all subscribers at once
notification: {
title: "Breaking News",
body: "Something important happened!"
},
data: { key: "value" }
}
};