Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Messaging Server response slow (1 minute)

I have a webserver which sends via PHP notifications with GCM to my developed Android app to users. There are about 3000 users, some users receive about 20 notifications per day.

It worked perfectly for more than 1 year, but since 5 days I see that the response time of the call to "https://android.googleapis.com/gcm/send" is 1 minute instead of less than 1 second before. And still all notifications arrive at the users.

It is developed in the following way: http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

I disabled the sending of notifications for more than 1 day. Then started it again, and for some minutes googleapis responded as usual, but then again a response time of 60 seconds.

It looks like Google is doing this on purpose, but I do not know why?

like image 543
JarnoQ Avatar asked Oct 20 '22 06:10

JarnoQ


1 Answers

try running :

curl https://apis.google.com/

and

curl https://apis.google.com/ --ipv4

if the 2nd one ran faster , just disable ipv6 on your server, maybe the ISP of your server doesn't support IPv6 yet which leads to 1-2 minute delay before it times out and switches to IPv4 again.

Another issue i ran into lately was the throttling GCM: how to avoid throttling

basically google will throttle your push messages if you send too many messages to the same user in a short period of time. this is to "save battery" and "bandwidth" (probably their ones) ... remember if you want to send data to a device more than 10 times a minute and while the user is actually using the app, it is always better to open a direct TCP connection between then user and your server :)

like image 84
Rami Dabain Avatar answered Oct 23 '22 01:10

Rami Dabain