Summary of wechat development agreement

1. The published message corresponds to an ID (as long as a single direction is unique, the server may judge repeated reception based on the root ID). The message retransmission mechanism ensures limited retries. If the retry fails, the user will be prompted. If the message is sent successfully, a feedback confirmation will be given. The client will know that the message is sent successfully only after receiving the confirmation information. The message may not generate a new synckey.

2. With the status message synchronization mechanism based on the version number (synkey), the incremental and orderly transmission requirements are natural. Long connection notification / short connection acquisition, confirmation, etc. the interaction mode is simple, ensuring the reliable and accurate arrival of messages.

3. The client / server will store the message ID processing record to avoid repeated consumption. If the client obtains the latest message but fails to confirm, the server will not think that the message has been consumed. The client will retrieve the next time and query whether the current message has been processed. According to some phenomena.

4. Generally speaking, wechat protocol is cross platform (both TCP and HTPP can be presented, and the processing method can be unified). It is very reliable through "handshake" synchronization. No matter which platform can support it well

5. The minimum cost of wechat protocol is 16 bytes. Most of the time, several message packets are combined and transmitted in batches. Wechat protocol is not the most concise and traffic saving, but it is very successful.

6. If the server detects some uncertain factors, it may cause the micro to enable the secure socket layer SSL protocol for conventional TCP long connection transmission. Short connections have not changed

7. Message sending method

Send a message, go through the established TCP long connection channel, send a message to the server, and then accept the confirmation information to generate an interaction.

Small partners will also receive server-side notifications and generate an interaction when they receive information reading.

It can be determined that wechat sends messages in the TCP long connection mode. Because it will not affect its own status data, synckey should not be exchanged.

In a low-speed network, you will probably see a prompt during message sending, which belongs to the message retransmission mechanism

The network is not good, and sometimes the client will have a red exclamation point for sending failure

For messages that have been sent to the server but have not received confirmation, the client displays a red exclamation mark and resends them again. The server processes them as duplicate messages and feeds back confirmation

When uploading a picture, it will be divided into several parts according to the size of the picture (about 1.5k is divided into one part). 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 will be sent to the server as a regular text message

When uploading audio, go through the TCP channel separately, and record audio for two seconds. After the client completes recording, it is divided into two transmission blocks, one of which is about 1.5k at most. The server responds to a data notification to confirm receipt. Three data transmissions in total.

Audio and plain text messages are consistent. They are sent by the client and confirmed by the server through a long TCP connection.

The above is the summary of wechat development agreement introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>