Everybody tells me that polling server for new data is stupid if the server is yours and you should implement push with GCM instead. Well, I agree and have done so but, I was wondering, how often can or should you perform push?
I have a simple app where people post stuff to the server and have a feed of everyone else's posts. The method on the server that does the saving to the database also triggers the GCM Push at the end, so Google sends out the push notifications to everybody and everybody then requeries the server for new posts, containing the post weve just made.
But, what if I have, lets say milion users and a new post is created lets say every minute. This will mean that app will connect to server every minutes and will kill the battery. So my question is, how often you perform Push? Wouldnt in this case polling every 10 minutes be actually better for battery, right?
I know this example is kind of crazy, having milion people in your feed, but its just to make a point, because I cant imagine how this would scale. I figure Google will handle sending million gcm messages at once no problem.
So the question is, is there a limit after which Push is contraproductive? I guess its kind of a first world problem :D but cant imagine Facebook handles stuff like this.
Thanks!
Push notifications are welcome when the server has important new data to show to the user (and by important I mean important to the user).
I believe that if any app sent me a notification every minute I would either disable notifications from that app or uninstall that app. You should be very carefull when deciding what updates to send to your users as push notifications, in order not to antagonize them. If your server can send push notifications very often to the same device, you must have settings options in your app that can reduce the frequency of those notifications.
Push notifications are usually relevant when the app is not running (or is running in the background). When it is running in the foreground, polling the server is probably a better solution (given the disclaimer that you can't rely on the push notifications being delivered every time).
In your example, I'm not sure I'd want to be notified automatically about each new post in the DB. Even while I'm using the app (i.e. it's in the foreground) I wouldn't want it to update with new posts automatically. Even facebook don't update the view automatically (they show you on top of the screen that you have new posts, and you have to pull the list view down in order to load them. And when the app is not running, I'd want to be alerted only about important posts (for example, posts from specific users). When an app sends me too many push notifications, I go to its settings to reduce them.
I can't give you a numeric figure of a reasonable frequency of push notifications, but I hope my answer helps. In short, you don't have to worry about GCM's technical limits. You should worry about the user experience.