1. The published message corresponds to an ID (as long as a single direction is unique, the server may repeat reception based on the ID). The message retransmission mechanism ensures a limited number of retry attempts. If the retry fails, the user will be prompted. The successful sending will be feedback and confirmation. The client will only know that the sending is successful after receiving the confirmation information. Sending a message may not generate a new SyncKey.
2. The status message synchronization mechanism based on the version number (SynKey), incremental and orderly transmission requirements are natural. Long connection notification/short connection acquisition, confirmation, etc., the interaction method is simple, ensuring reliable and accurate messages.
3. The client/server side will store the message ID processing record to avoid repeated consumption of the client to obtain the latest news, but the server side will not think that the message has been consumed. The client will re-get it next time and will query whether the current message has been processed. Based on some phenomena.
4. Overall, the WeChat protocol cross-platform (both TCP or HTPP can be presented, and the processing method can be unified), and synchronized through "handshake" is very reliable, and no matter which platform can support it well.
5. The minimum cost of the WeChat protocol is 16 bytes. Most of the time, several message packets are combined together and are transmitted in batches. The WeChat agreement is not the simplest, nor is it the most traffic-saving, but it is very successful.
6. If the server detects some uncertainties, it may cause the micro-enabled Secure Sockets Layer SSL protocol to perform conventional TCP long connection transmission. No short connection changes
7. Send message method
Send a message to go through the established TCP long connection channel, send a message to the server, and then accept confirmation information, etc., to generate an interaction.
When friends receive information reading, they will receive a server notification, which will generate an interaction, etc.
It can be confirmed that WeChat sends messages to TCP long connection mode, because it does not affect its own status data, SyncKey should not be exchanged.
Under a low-speed network, you will probably see a prompt in message sending, which belongs to the message resend mechanism
The network is not good sometimes the client will have a red exclamation mark that fails to send.
The message that has been sent to the server but has not received a confirmation, the client displays a red exclamation point, and resends it again, the server processes it as a duplicate message, and feedback confirmation
Uploading images will be divided into several parts according to the size of the image (about 1.5K is divided into parts). At the same time, the client will initiate several POST requests. After each upload is successful, the server will probably merge into a complete picture, return a thumbnail, and display it in the APP chat window. The APP is sent to the server as a regular text message
When uploading audio, go to the TCP channel alone, and record audio in two seconds. After the client has finished recording, it is divided into two blocks to transmit, one block is about 1.5K. The server responds to a data notification to confirm receipt. Three data transmissions in total.
The audio and plain text information are consistent, both of which are TCP long connections, sent by the client and confirmed by the server.
The above is the summary of the WeChat development agreement introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!