On Android, GCM (Google Cloud Messaging, originally called C2DM), which is standard for Android implemented by Google, is basically unavailable in China. Therefore, if the Push function is required for developers, how to choose to become a problem. So far, there is no free and open Push service available to developers in China. There are several third-party push services abroad, but charges are generally incurred. Therefore, developers in China have to consider building Push services on their own. When building the Push Service by yourself, a natural choice is to do it based on the open-source current solution. Using Google or Baidu to search for keywords such as "Android Push" indicates that many people have studied it. There are several articles on the front:
- Android push Solution
- Push using androidpn
- Push on Android
- Android Push Notification for Information Push
In the above solution, we basically mentioned an open-source Android Push implementation: androidpn. Androidpn is essentially based on Openfire on the server side and asmack on the client side. Both are the two basic components in the xmpp im open-source implementation, it should be said that androidpn only integrates the two more for Push scenarios. I have used chat apps and would like to share with you the practical experience of using the XMPP open-source system as IM. We started with the open-source xmpp im System at the beginning. Let's talk about server selection first. Openfire is the oldest open-source IM Server of XMPP. Almost all IM users should have studied it. However, it is also the most unsuitable IM Server for production, because the single-host concurrency is very limited, the cluster solution is not mature, and the code is old and lacks timely updates. For example, the cluster component of Openfire is called Connection Manager. However, you can see on the Openfire official website that the latest version was released in July. It can be seen that the foundation of androidpn Based on Openfire is unstable. Update: chat with an Openfire-based chat App. Their users are large and there are multiple Openfire nodes as clusters. They have made a lot of changes to Openfire. For example, XMPP protocol interaction is complex and needs to be simplified. XMPP protocol text is bloated and is converted to binary. The cluster is completely self-developed. They can load up to 0.3 million users at a single point. There are two other relatively better options: ejabberd and tigase. Ejabberd is implemented in the Erlang language and has very few users who know Erlang, so it is generally not selected. At that time, the initial chat server was tigase (implemented in Java ). The tigase author is very active in maintenance, and the cluster test results can support relatively large capacity, which attracts us. However, according to the actual production and operation conditions, due to the complexity of the implementation of the cluster solution and the limited capacity of a single node, we have no confidence in supporting 0.5 million users on the cluster nodes, so before arriving at 0.5 million users, I quickly developed an alternative solution. In addition, the XMPP protocol and client problems: for mobile clients, the original XMPP is complicated and the traffic consumption is high. In essence, XMPP is based on the xml structure of strings. Each Protocol has a bunch of strings, and there are many meaningless structures in xml. In addition, for the sake of its flexibility, XMPP requires N back and forth to log on. XMPP is heavy for mobile clients that care about traffic and power usage. Our practice is: the Protocol format is changed to binary, the Protocol content is simplified for interaction, but the compatibility with the original XMPP is retained. Androidpn is an open-source Push implementation and is integrated based on XMPP open-source components. It does not provide necessary optimization for mobile phone application scenarios. In addition, XMPP is essentially a two-way IM protocol, and the Push function is directly implemented based on XMPP, which is not particularly optimized for the characteristics of Push, such as the client network connection policy. To sum up the problems that may occur in the typical open-source Android Push solution with androidpn: 1) if the capacity of an open-source server is too large, you still need to improve the open-source implementation, or completely reuse the new solution. development investment and high achievement are inevitable. 2) Protocols and implementations, such as traffic consumption and network connection policies, are not optimized specially for mobile Push and are not economical. Based on our team's practical experience in implementing chat apps Based on XMPP open-source systems, we have concluded that in Mobile IM scenarios, open-source solutions are not a usable solution. Later, we completely re-built the entire system. Later, Aurora push was developed based on the new architecture of the IM system. Aurora Push is specially developed for real-time Push in Mobile scenarios. We want to solve the problem that Android Developers in China do not have an available and easy-to-use Push solution, which is free of charge and fully open to common developers. If you need Android Push, go to the official website of Aurora Push to learn more. |