What technology does GCM (Google Cloud Messaging) use?

Deadly 提交于 2019-12-24 04:23:05

问题


Does it work by polling the servers periodically ? Does it work using long-held http request , like comet ? Or theres some new technology they are using ?


回答1:


Here is a good overview: http://developer.android.com/google/gcm/gcm.html

Somewhere it explains that GCM is preferred to the app polling because the Android OS is doing the polling through a long-held OS connection to the GCM server. So even though they call it "push" technology it is really being polled/pulled by the device. The OS then tells the app there is a message and the app retrieves it. Google is just doing the work for all apps through one channel that the OS already uses to check for updates so the device won't be constantly polling as all apps check back to their servers if GCM wasn't used.

There are IDs that help the OS know which app needs which message and the developer needs to set up and maintain a server that helps "push" the messages to device(s). There can be broadcast type messages or messages targeting individual devices. Google outlines a couple of different types of communication mechanisms - HTTP and XMPP.

No real new technology - Google is just providing a platform/interface/architecture for developers.

This info just touches the surface - there is much more detail in the documentation.



来源:https://stackoverflow.com/questions/28536105/what-technology-does-gcm-google-cloud-messaging-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!