Protocol used for sending push notification in Android

后端 未结 4 1805
独厮守ぢ
独厮守ぢ 2021-02-04 09:39

I want to know which protocol is used to send push notification to android devices and which to send push notification requests to GCM.

Whether it is HTTP, HTTPS or some

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 10:39

    The protocols of the communication between the 3rd party server and GCM server (HTTP or XMPP) were already mentioned in the other answers.

    The protocol of the communication between the device and GCM server is not discussed in the GCM documentation, since you never have to access it directly as an Android application developer, and therefore you don't need to know about it.

    However, here's a quote from a Google developer from the team that created GCM, which says a few things about the connection. From what he says, you can only know that it's a long-lived TCP connection.

    GCM maintains a long-lived connection - and reconnects if it knows the connection was broken. A router/AP/NAT is supposed to send a FIN or RST to terminate the TCP connection - so GCM and servers will know the connection is dead.

    However a number of routers and mobile operators don't do this, and then GCM needs to rely on the heartbeat, ~15 min on Wifi, more on mobile.

    (The quote is taken from an answer by that person)

提交回复
热议问题