I developed an app that allows to see or download some files from my VPS. Every day, I'm adding new files (one or two times per day) and I want to notify my users, that there are new files available.
I heard about Google Cloud Messaging, but there is a limit - only 100 messages can be stored. But I think that I get it wrong. This is 100 messages per one device or 100 messages in GCM server?
So far I have more than 8000 active users and I am afraid that some of them will not get notification.
Note: There is a limit on how many messages can be stored without collapsing. That limit is currently 100. If the limit is reached, all stored messages are discarded. Then when the device is back online, it receives a special message indicating that the limit was reached. The application can then handle the situation properly, typically by requesting a full sync.
The 100 message limit is per device and not per application. So if you send 100 messages from your app to a specific device which is offline then all 100 will be dropped.
If I am sending out a message to a few thousand devices, it is expected at least 100 of them to be (temporarily) offline. It doesn't make sense discarding the whole batch.
Google Cloud Messaging
Related
When you use FCM to send a push to all devices of a given app this can result in many users opening their apps at the same time which can lead to massive server polling resulting in load peaks.
Is there a convenient way to distribute a message over a given time interval for scheduled pushes?
Finally we found a possible way to archive the goal of a time based distribution by defining pseudo-random topics with a given range.
As an example the app calculates a random integer number between 0 and 9 and uses it as a postfix for a randomized segmentation ("segment_0" to "segment_9"). Now you can distribute the push by sending pushes to the defined segments programmatically or using the Firbase Console over a given timespan.
There is nothing built in that I know of to cause some pseudo-random distribution of delivery. But here are some options I can think of:
From the Firebase console you can schedule the message to be delivered in the user's timezone. If you have a global audience, this means the delivery of the messages will be spread out globally.
Through the API you can delivery a data-only message with the information. This message type is not automatically displayed by the system, but always delivered by your application code. your code can then hold the message and display it after a random delay.
I am using google firebase tool to send push notification to all users at once. Because of this, all notifications reach the user at the same time and it causes momentarily spike in the number of the API request. Normally my backend system handles around 1K requests per minute but during notification, I am getting 40K request at once.
So Instead of sending a notification to all users at once, I want to distribute uniformly over period of 10 minutes. But I do not find any solutions in the firebase. Please help.
I have a IOT project where multiple devices update their current locations to the IOT server. The server parses the hex data received and stores them in a MySQL database. I have a independent REST API server that queries this database to retrieve the current position of the device and display it on a map in Android.
Now because of the refresh rates of the device and the Android API request, there is a considerable latency in updating the positions on the map. How can I convert this to a real-time design, eliminating the need to read from the database but just directly sending the data to the Android client?
Note: Multiple android devices may request live updates of the same GPS device.
I am considering using firebase GCM push notifications to deliver the position to an Android/iOS device which has requested for the live view updates. However, I think this would be inefficient. As this would not be very stateless as I would have to monitor the list of devices currently requesting push notifications and do some handshaking to start/stop the notifications.
Can I use web sockets instead to make a connection between the android and the server app itself? Does the quality of the internet connection matter excessively here? I realize that somewhat like UDP for updating the position the most recent packet alone matters here and any skipped position data won't contribute much.
based on our discussion
I think GCM is a good enough option for this kind of problems.
Your total number of users and concurrent users are not that much, As I know there is a limitation for FCM that is " For each sender ID, FCM allows 1000 connections in parallel." you can find it here
The other limit is about number of stored messages at FCM. Offline users do not receive messages until the become online and the limit is 100 messages. so this can be a problem, but when the user become online FCM will send a message that can be handled in client, I mean you will informed of the situation so you can ask the server to send last update messages, but if the only last one is important for you, this is not the case and you do not have any problem, because the client will receive the last update very soon.
Anyway, based on GCM/FCM you just need to worry about sending messages when you will get updates. Consider that GCM is not about only push notifications, you can handle the messages inside BroadcastReceiver.With FCM, you can send two types of messages to clients: reference
Notification messages, sometimes thought of as "display messages."
Data messages, which are handled by the client app.
in this case you need to use data messages.
So, based on these information, I suggest following scenario :
Devices send updates to the server side.
server will send GCM messages for the interested clients
on the server side, you can handle the interested clients and you need to make it parallel.
Hope this helps you. if there is any other aspect we should consider, let me know.
thanks
We're building an application server which will be used to send push notifications to android and ios clients via GCM connection server. Our plan is to use HTTP interface to connect with GCM as we only want downstream messaging. could you please tell me what is the performance of GCM for HTTP interface? I'm looking for some kind of performance data like how many push notifications messages per second GCM can support? I checked GCM site but couldn't find this. Please help to guide from where i can get such data?
as per the official Google answer
The rate limit exception code indicates that you are sending messages from a backend server too frequently. To ensure a stable service, there is a per minute / per device app upper limit on the number of messages that can be sent from a backend server. This limit is set high so most well behaving apps should not be affected, all apps should however be prepared to receive this error code.
They do not specify the "actual limit" but they do say This limit is set high so most well behaving apps should not be affected so as long as you re not spamming a single device like crazy you should be ok with whatever you send at it.
However please note that you can get throttled and have the messages be delayed
Google note about GCM "There is a limit on how many messages can be stored without collapsing. That limit is currently 100. If the limit is reached, all stored messages are discarded. Then when the device is back online, it receives a special message indicating that the limit was reached. The application can then handle the situation properly, typically by requesting a full sync."
so how to my application should requesting a full sync?
This is completely up to you since you need to sync with third party server but
not with the GCM server.
You can follow the same procedure that how you would sync your mobile app with your server.