Before, I was responsible for the implementation of the bottom layer of Android client chat for an Internet company. I had participated in the design of the chat protocol before, and I had a look at the server architecture. Since it went online, no user has reported missing messages, and the DAU is probably hundreds of thousands ( I forgot the exact number)
Chat is really difficult to do. The key is not knowing what kind of chat system you want. For example, how high are the requirements for system reliability? As far as I know, xmpp does not guarantee reliability. So the first problem you encounter is the protocol. Different protocols have different features and characteristics.
In comparison, the performance of the server is really not particularly important. After all, it is very laborious to implement the protocol correctly, and it also needs to leave room for subsequent development to facilitate expansion (this is still a matter of the protocol).
As for the implementation of the client, it is not easy either, including database, long connection, and UI display. If something is not done well, a bunch of users will complain about the power consumption, data traffic, UI card and other small things.
Also, for chat users, if users are asked to drop a few messages, users really don’t want to use it anymore. Message reliability is really important.
The network conditions of the client have not been mentioned yet. The compatibility of the WAP network is flawed, and the protocol under the socket cannot be used at all. . .
WeChat is really awesome. . .
Same recommendationPomelo, lz I also have the same idea, I would like to try it out when I have some free time.
What the people above said are good, I will post another tutorial: Tutorial----Distributed Chat Server
=======Add========
Well, actually I have done XMPP, which is very complicated and heavy, especially for mobile chat rooms, traffic is a problem. In addition, it is actually good to use Erlang to make messages. It is said that the core of the backend of MiLiao is made of this.
https://github.com/xiaowudesign/nowboard There is one that enables online information exchange by logging in through Weibo. Just to give the poster an idea.
I have written something similar, http://itorr.sinaapp.com/comet/ As long as it can send and receive messages and return new messages in a timely manner, it can be done with php + long connection.
//Source code to be attached
Before, I was responsible for the implementation of the bottom layer of Android client chat for an Internet company. I had participated in the design of the chat protocol before, and I had a look at the server architecture. Since it went online, no user has reported missing messages, and the DAU is probably hundreds of thousands ( I forgot the exact number)
Chat is really difficult to do. The key is not knowing what kind of chat system you want. For example, how high are the requirements for system reliability? As far as I know, xmpp does not guarantee reliability. So the first problem you encounter is the protocol. Different protocols have different features and characteristics.
In comparison, the performance of the server is really not particularly important. After all, it is very laborious to implement the protocol correctly, and it also needs to leave room for subsequent development to facilitate expansion (this is still a matter of the protocol).
As for the implementation of the client, it is not easy either, including database, long connection, and UI display. If something is not done well, a bunch of users will complain about the power consumption, data traffic, UI card and other small things.
Also, for chat users, if users are asked to drop a few messages, users really don’t want to use it anymore. Message reliability is really important.
The network conditions of the client have not been mentioned yet. The compatibility of the WAP network is flawed, and the protocol under the socket cannot be used at all. . .
WeChat is really awesome. . .
Recommend pomelo
Same recommendation
Pomelo
, lz I also have the same idea, I would like to try it out when I have some free time.What the people above said are good, I will post another tutorial: Tutorial----Distributed Chat Server
=======Add========
Well, actually I have done XMPP, which is very complicated and heavy, especially for mobile chat rooms, traffic is a problem. In addition, it is actually good to use Erlang to make messages. It is said that the core of the backend of MiLiao is made of this.
Reference firebase
https://www.firebase.com/
https://github.com/xiaowudesign/nowboard There is one that enables online information exchange by logging in through Weibo. Just to give the poster an idea.
Web can use socket.io (it’s node.js, I can’t say go). There are specific tutorials on how to build a chat room using socket.io and express
Based on xmpp, the server has open source openfire, tigase, etc.
The web side can use jsjac, strophe, etc.
We just implemented one using socket.io, and the cache uses redis
I have written something similar, http://itorr.sinaapp.com/comet/ As long as it can send and receive messages and return new messages in a timely manner, it can be done with php + long connection.
//Source code to be attached
Many applications use xmpp, it seems