【Android Learning】Message Push

1. XMPP protocol (commonly used)

1) Concept

It is an XML-based delivery protocol with strong flexibility and extensibility. It features a shift of complexity from the client to the server. GTalk, QQ, IM, etc. all use this protocol.
Including the bottom layer of the GCM server is also encapsulated by the XMPP protocol.

2) Advantages and disadvantages

Advantages:
The protocol is mature, powerful, and highly scalable. It is currently mainly used in many chat systems, and there is an open-source Java version of the development example androidpn.

androidpn(Android Push Notification):
基于 XMPP 开源组件的一套整合方案,服务端基于Openfire、客户端基于Smack。到AndroidPN项目主页( http://sourceforge.net/projects/androidpn/ ) 下载2个文件: androidpn-server-0.5.0-bin.zip 和 androidpn-client-0.5.0.zip 分别是服务器和客户端的代码。详细的实现方式网上有不少文章。
1.androidpn服务端重启后客户端不会重连,这个非常悲剧
2.由于服务器不保存消息,造成了如果客户端当前离线就收不到消息
3.androidpn发送完消息就不管了,所以没有消息回执报表之类,造成没法做应用后续的数据分析用户体验的改善,这对于企业级的应用是个致命伤。

XMPP协议比较费电费流量,这个对当前智能机的消耗太大,在窄带网络和不稳定的(手机)网络都不是最优的选择。但总体来说,XMPP协议还是比较成熟的。

Disadvantages:
The protocol is complex, redundant (based on XML), expensive traffic, electricity, and high cost of deploying hardware.

2, polling

1) Concept

The client periodically goes to the server to fetch or maintain a long socket. In essence, this is not called push, but to the server to pull data. But the implementation is simple,

2) Disadvantages

Advantages:
Simple implementation, strong controllability, and low deployment hardware cost.
Disadvantages:
poor real-time performance, power consumption, waste of user traffic, etc.

3,GCM(Google Cloude Messaging,C2DM,Android Cloud to Device Messaging)

1) Concept

Google's push.
Android's own push GCM helps developers send data to their Android applications. It is a lightweight message that tells the Android app that there is new data to fetch from the server, or it could be a message that contains 4KB of payload data (apps like instant messengers can use the payload message directly ). The GCM service processes the queued messages and delivers them to the Android application running on the target device.

2) Advantages and disadvantages

Advantages: The services provided by Google are native and simple, and there is no need to implement and deploy the server.
Disadvantages:
1. Requires Android 2.2 or above, and cannot be pushed to many systems before 2.2;
2. Domestic service is unstable. And many domestic terminal manufacturers have removed Google's services and replaced them with their own.
3. Users are required to bind a Google account, but many domestic users do not have a Google account.

4,SMS

1) Concept

via SMS

2) Disadvantages

But it's hard to find free SMS platforms

3) Several major domestic manufacturers

① millet

② push

③Youmeng

④Baidu Cloud

⑤Aurora

⑥ carrier pigeon

⑦Huawei

5. MQTT protocol

1) Concept

A push service provided by IBM, which is not very flexible. A lightweight, broker-based "pub/sub" pattern message transport protocol.

2) Advantages and disadvantages

Advantages:
The protocol is simple, compact, scalable, saves traffic, and saves power. It has been applied to the enterprise field (refer to: http://mqtt.org/software ), and there is a C++ version of the server component rsmb.
Disadvantages:
immature, complex implementation, server-side component rsmb is not open source, and the cost of deploying hardware is high.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325534815&siteId=291194637