Home > WeChat Applet > WeChat Development > Description of WeChat Development Agreement

Description of WeChat Development Agreement

PHPz
Release: 2017-04-02 15:23:55
Original
1745 people have browsed it

1. The published message corresponds to an ID (as long as it is unique in a single direction, the server may judge repeated reception based on the ID). The message retransmission mechanism ensures a limited number of retries. If the retry fails, the user will be prompted and the message is sent successfully. A confirmation message will be sent back, and the client will know that the sending was successful only after receiving the confirmation message. Sending Message may not generate a new SyncKey.

2. Based on the version number (SynKey) status message synchronization mechanism, incremental and orderly transmission requirements are naturally fulfilled. Long connection notification/short connection acquisition, confirmation, etc., the interaction method is simple, ensuring that messages arrive reliably and accurately.

3. The client/server will store message ID processing records to avoid repeated consumption. The client obtains the latest message, but it is not confirmed. The server will not consider the message to be consumed. The client will retrieve it next time and check whether the current message has been processed. Guess based on some phenomena.

4. Generally speaking, the WeChat protocol is cross-platform (TCP or HTTP can be presented, and the processing method can be unified). It is synchronized through "handshake" and is very reliable. No matter which platform it is, it can be supported very well

5. The minimum cost of the WeChat protocol is 16 bytes. Most of the time, several message packages are combined together and transmitted in batches. The WeChat protocol is neither the simplest nor the most traffic-saving, but it is very successful.

6. If the server detects some uncertain factors, it may cause micro-enablement of the Secure Sockets Layer SSL protocol for regular TCP long connection transmission. The short connection has not changed

7. Sending message method

Send a message through the established TCP long connection channel, send the message to the server, and then accept the confirmation message, etc., resulting in an interaction.

When friends receive information and read it, they will also receive server-side notifications, resulting in an interaction, etc.

It can be determined that WeChat uses TCP long connection mode to send messages. Since it does not affect its own status data, SyncKey should not be exchanged.

Under a low-speed network, you may see a message sending message, which belongs to the message resending mechanism

If the network is not good, sometimes the client will display a red exclamation mark indicating that the sending failed

The message has been sent to the server but has not been confirmed. The client displays a red exclamation mark and resends it again. The server treats it as a duplicate message and the feedback is confirmed.

Uploaded pictures will be divided into several parts according to the size of the picture ( 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 it into a complete picture and return a thumbnail, displayed in the APP chat window. The APP sends it to the server as a regular text message

UploadAudio, then it uses a separate TCP channel to record a two-second audio. After the client completes the recording, it is divided into two parts for transmission, one The maximum size is about 1.5K, and the server responds with a data notification to confirm receipt. A total of three data transfers.

Audio and plain text information are the same. They are both sent via TCP long connection, sent by the client and confirmed by the server.

The above is the detailed content of Description of WeChat Development Agreement. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template