In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the example analysis of Wechat development protocol, the article is very detailed, has a certain reference value, interested friends must read it!
1. The published message corresponds to an ID (as long as the single direction is unique, the server may decide to receive it repeatedly by the root ID). The message retransmission mechanism ensures a limited number of retries. If the retry fails, the user will be prompted, and the successful delivery will be confirmed by feedback. The client will know that the delivery is successful only if it receives the confirmation message. Sending a message may not generate a new SyncKey.
two。 Based on the version number (SynKey) status message synchronization mechanism, incremental and orderly transmission requirements come naturally. Long connection notification / short connection acquisition, confirmation, etc., the interaction is simple to ensure that the message can be reliable and accurate.
3. The client / server will store the message ID processing record to avoid being repeatedly consumed by the client to get the latest message, but without confirmation, the server will not think that the message has been consumed. The next time the client will retrieve it, it will query whether the current message has been processed. Guess according to some phenomena.
4. Generally speaking, the Wechat protocol is cross-platform (both TCP or HTPP can be presented, and the processing method can be unified). It is very reliable through "handshake" synchronization, and can be well supported on either platform.
5. The minimum cost of Wechat protocol is 16 bytes, and several message packets are transmitted in batch most of the time. The Wechat agreement is not the simplest or the most traffic-saving, but it is very successful.
6. If the server detects some uncertainties, it may lead to the micro-enabling of secure socket layer SSL protocol for conventional TCP persistent connection transmission. The short connection has not changed.
7. Mode of sending messages
Send messages through the established TCP persistent connection channel, send messages to the server, and then receive confirmation messages, etc., resulting in an interaction.
When a partner receives a message to read, he will also receive a notification on the server side, resulting in an interaction and so on.
It can be determined that Wechat sends messages in the way of TCP persistent connection, because it does not affect its own status data, so it should not exchange SyncKey.
In a low-speed network, you will probably see the prompt in message sending, which belongs to the message resending mechanism.
When the network is not good, sometimes the client will have a red exclamation mark that failed to send.
A message that has been sent to the server but has not received an acknowledgment, the client displays a red exclamation mark and sends it again, and the server handles it as a duplicate message and feedback confirmation.
The uploaded image will be divided into several parts according to the image size (about 1.5K is divided into parts). At the same point in time, the client will initiate several POST requests. After each uploaded successfully, the server will probably merge into a complete image and return a thumbnail, which will be displayed in the APP chat window. APP is sent to the server as a regular text message
If you upload audio, you will use the TCP channel alone to record the audio for two seconds. After recording, the client is divided into two parts for transmission. The maximum value of one is about 1.5K. The server acknowledges receipt in response to a data notification. There are three data transmissions.
Audio and text messages are consistent, both go through the TCP long-term connection, sent by the client, and confirmed by the server.
The above is all the content of this article "sample Analysis of Wechat Development Protocol". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.