Dear All,
Our app is an expo app used by 50,000 users. We send notification to all users many times a day. I have read the documentation and figure out that i can send only to 100 device a time. Using this approach, it will force me to send 500 post request to expo server in order to send notification to all devices.
I am looking for a way to send notification to all user with less request to expo server.
Thank You
This isn’t possible.
From your server you will need to batch requests 100 at a time. If you use expo-server-sdk
this will be handled for you.
There are also community supported versions of the Expo Server SDK for other backend languages:
From the expo-server-sdk
docs:
// The Expo push notification service accepts batches of notifications so
// that you don't need to send 1000 requests to send 1000 notifications. We
// recommend you batch your notifications to reduce the number of requests
// and to compress them (notifications with similar content will get
// compressed).
let chunks = expo.chunkPushNotifications(messages);
let tickets = [];
(async () => {
// Send the chunks to the Expo push notification service. There are
// different strategies you could use. A simple one is to send one chunk at a
// time, which nicely spreads the load out over time:
for (let chunk of chunks) {
try {
let ticketChunk = await expo.sendPushNotificationsAsync(chunk);
console.log(ticketChunk);
tickets.push(...ticketChunk);
// NOTE: If a ticket contains an error code in ticket.details.error, you
// must handle it appropriately. The error codes are listed in the Expo
// documentation:
// https://docs.expo.io/versions/latest/guides/push-notifications#response-format
} catch (error) {
console.error(error);
}
}
})();