-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error code EMFILE sending message to 19.000 devices #275
Comments
@cmarrero01 Are you trying to send 19,000 messages with that code? Doing it this way would que up 19,000 HTTP requests to the FCM API, which is definitely not something we want to do. The FCM allows sending to 1,000 registration IDs in the same request. You should implement a batch mechanism to split up the 19k devices and send only 19 requests via Sample implementation: |
Of corse that my code above is an example only, my real code is more complex but with the same result. The thing is the message is different for each device, so, I need send each message individualy. For send batch messages I do something like this.
|
If each message is different, you need to implement a queue mechanism so that you don't attempt to send 19,000 requests at the same time.
|
The problem here is if take 500 ms to send 1 message, send 19.000 will take 15 minutes to send all messages, I need this on real time. |
@cmarrero01 Then FCM is not the right solution for your realtime requirements, especially when each message is highly individual. There's always the possibility of spinning up more servers to send more concurrent requests to FCM, but you'll need a crazy amount of servers to send 19,000 unique notifications in one second, not to mention a robust backend architecture. There are alternative services to FCM that might be able to provide what you are looking for. |
@cmarrero01 Could you consider doing the individualized lookup on the recipient devices? This would allow you to send identical messages to all devices. The messages would then basically be "ping to fetch" messages, letting the device know that it needs to show a notification for something, but letting the device build the notification. |
HI,
I try to send a push notification to 19.000 devices each per each, and I receive the next error:
The code is:
None message was sent...
The text was updated successfully, but these errors were encountered: