Devanada
Devanada

Reputation: 177

Expo how to manage a thousand FCM token for Push Notification?

I made an app that wants to blast (thousand users) notification using expo-notifications, like expo docs said https://docs.expo.io/push-notifications/sending-notifications/#http2-api, I send POST request to https://exp.host/--/api/v2/push/send, but when I tried to implement it on the server, it takes minutes to process it, because there are too many FCM token in the database. The reason why I didn't use some SDK like on the link before because my BackEnd used languages that not listed on the expo docs. How can I achieve that?

Upvotes: 0

Views: 627

Answers (1)

Stanisław Chmiela
Stanisław Chmiela

Reputation: 471

There are multiple things you can ensure you're doing to be sure you're sending the notification requests the right way.

  1. Are you sure you're using to argument as an array containing multiple tokens instead of firing multiple HTTP requests to the same endpoint? Sending thousands of HTTP requests instead of one with multiple tokens may take significantly more time to finish.
  2. Are you using GZip compression on the requests? As per the documentation

    This can greatly reduce the amount of upload bandwidth needed to send large numbers of notifications.

As far as I know:

  • Expo servers can handle thousands (duh, millions) of notifications easily.
  • a request to exp.host/…/send doesn't actually wait for the notification to be sent, it's only a "put the notification on the queue", so there's no reason for the request to take any long time.

Another question I'd have is what language, library are you using on your backend and how are you sending the request to the Expo servers? Maybe there's some problem?

Upvotes: 0

Related Questions