Message Sending Method, Device, Equipment and Storage Medium
By switching to the QUIC protocol when the message is sent by a long TCP connection fails and generating QUIC evaluation results based on the message sending situation, the head of the queue blocking caused by long TCP connections in a weak network environment is solved, and the success rate and efficiency of message sending are improved.
Patent Information
- Application Number
- CN202111038621.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-06
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2041-09-06
AI Technical Summary
In a weak network environment, sending messages based on long TCP connections can easily lead to head-of-line blockage, resulting in excessive delay in message transmission or inability to send, affecting the success rate of message transmission.
When the TCP long connection sends a message, switch to the QUIC protocol to send a message, and determine the availability of the QUIC protocol in the current network environment before switching. By sending a message and generating QUIC evaluation results, the availability of the QUIC protocol is determined.
By switching to the QUIC protocol, the problem of head-of-line blocking is avoided, and the success rate and efficiency of message sending are improved, especially in weak network environments.
Smart Images

Figure CN115776527B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of communication technologies, and in particular, to a message sending method, apparatus, device, and storage medium. Background Art
[0002] During communication, when a message sending device communicates with a message receiving device, it needs to communicate based on a communication protocol.
[0003] Among them, during the message sending process, it mainly exists to send based on the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP). Due to the unreliability of UDP transmission, messages are mostly sent based on the TCP channel. When sending messages based on the TCP channel, in a weak network environment, there will be serious head-of-line blocking, resulting in too high message sending latency or even unable to send messages, affecting the message sending success rate.
[0004] Therefore, when sending messages based on a TCP long connection, it is easy to cause message sending failures, that is, the message sending success rate is relatively low. Summary of the Invention
[0005] Embodiments of the present application provide a message sending method, apparatus, device, and storage medium, which can improve the message sending success rate. The technical solutions include the following:
[0006] On the one hand, embodiments of the present application provide a message sending method, and the method includes:
[0007] Sending a target message to a receiving end through a TCP long connection;
[0008] In response to the failure of sending the target message and the absence of a QUIC evaluation result corresponding to the current network environment, sending the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol;
[0009] Generating the QUIC evaluation result corresponding to the current network environment based on the message sending situation of the target message under the QUIC protocol.
[0010] On the other hand, embodiments of the present application provide a message sending apparatus, and the apparatus includes:
[0011] A first sending module, configured to send a target message to a receiving end through a TCP long connection;
[0012] A second sending module, configured to, in response to the failure of sending the target message and in the absence of a QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol;
[0013] A generation module, configured to generate the QUIC evaluation result corresponding to the current network environment based on the message sending situation of the target message under the QUIC protocol.
[0014] On the other hand, an embodiment of the present application provides a computer device, including a processor and a memory, where at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the message sending method as described in the above aspect.
[0015] On the other hand, a computer-readable storage medium is provided, where at least one instruction, at least one program, a code set, or an instruction set is stored in the readable storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the message sending method as described in the above aspect.
[0016] On the other hand, an embodiment of the present application provides a computer program product or a computer program, including computer instructions, where the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the message sending method provided in the above aspect.
[0017] The beneficial effects brought by the technical solutions provided in the embodiments of the present application at least include:
[0018] In the embodiments of the present application, first, a message is sent to the receiving end through a TCP long connection. When the message sending through the TCP long connection fails, the protocol is changed, and the message is sent to the receiving end based on the QUIC protocol, which helps to improve the success rate of message sending; and before sending the message to the receiving end based on the QUIC protocol, it is determined whether there is a QUIC evaluation result corresponding to the current network environment. When there is no such result, the message can be sent to the receiving end based on the QUIC protocol, and then, based on the message sending situation of the message, the QUIC evaluation result corresponding to the current network environment is generated to determine the availability of the QUIC protocol in the current network environment, which helps to improve the success rate of message sending. Description of the Drawings
[0019] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0020] Figure 1 Shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;
[0021] Figure 2 Shows a flowchart of a message sending method provided by an exemplary embodiment of the present application;
[0022] Figure 3 Shows a flowchart of a message sending method provided by another exemplary embodiment of the present application;
[0023] Figure 4 Shows a flowchart of a message sending method provided by another exemplary embodiment of the present application;
[0024] Figure 5 Shows a schematic diagram of a protocol function module provided by an exemplary embodiment of the present application;
[0025] Figure 6 Shows a flowchart of a message sending method provided by another exemplary embodiment of the present application;
[0026] Figure 7 Shows a flowchart of a message sending method provided by another exemplary embodiment of the present application;
[0027] Figure 8 Is a structural block diagram of a message sending device provided by an exemplary embodiment of the present application;
[0028] Figure 9 Shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Detailed implementation manners
[0029] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the implementation manners of the present application in detail with reference to the accompanying drawings.
[0030] Figure 1 Shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. This implementation environment includes a first device 110, a server 120, and a second device 130.
[0031] The first device 110 is an electronic device running a client with a message sending function. Among them, the first device 110 can be an electronic device such as a smart phone, a tablet computer, a desktop computer, a multimedia playback device, a wearable device, a laptop computer, etc. The client can be an application program with a message sending function, which can be a social application program, a shopping application program, an instant messaging application program, etc.
[0032] The second device 130 is an electronic device running a client with a message receiving function. Among them, the second device 130 can be an electronic device such as a smart phone, a tablet computer, a desktop computer, a multimedia playback device, a wearable device, a laptop computer, etc. The client can be an application program with a message receiving function, and this application program can be a social application program, a shopping application program, an instant messaging application program, etc. Optionally, the application program for the message receiving function and the above-mentioned application program with a message sending function can be the same application program or different application programs, and this embodiment does not make a limitation on this.
[0033] The server 120 is used to provide background services for the clients in the first device 110 and the second device 130. For example, the server 120 can be the background server of the above-mentioned application program with a message sending function or a message receiving function. The server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0034] In a possible implementation manner, the client in the first device 110 sends a target message to the server 120, and the server 120 forwards the target message to the second device 130. Among them, the message sending method provided in the embodiments of the present application can be used in the process of the first device 110 sending a message to the server 120, and can also be used in the process of the server 120 sending a message to the second device 130, and no limitation is made here. For the convenience of description, the following will take the message sending method as an example of being executed by a computer device for explanation.
[0035] In the related art, the TCP long connection method is mostly used for message sending, and the TCP long connection is based on the TCP channel for message transmission. When in a weak network environment, due to the poor network environment, serious head-of-line blocking will occur, and there will be a serious delay in message sending or the message cannot be sent. The Quick UDP Internet Connection (QUIC) protocol is based on the UDP protocol. It can ensure the reliability of transmission without a connection and there is no head-of-line blocking problem. Therefore, in the embodiments of the present application, when the failure of sending the target message based on the TCP long connection occurs, the QUIC protocol will be switched to for use.
[0036] However, since the QUIC protocol is implemented based on the UDP protocol, there may be a situation where the UDP protocol is disabled in some network environments, which will cause the QUIC protocol to be unavailable. Or in some network environments, the success rate of sending messages using the QUIC protocol is low or the delay is high, and the QUIC protocol is also not applicable. Therefore, before switching to use the QUIC protocol, the embodiments of the present application first determine the QUIC evaluation result in the current network environment to determine the availability of the QUIC protocol. In the case where there is no QUIC evaluation result corresponding to the current network environment, messages can be sent based on the QUIC protocol, and the QUIC evaluation result corresponding to the current network environment can be determined according to the message sending situation, which is convenient for subsequent terminals in the same network environment to determine the availability of the QUIC protocol based on the QUIC evaluation result.
[0037] Please refer to Figure 2 , which shows a flowchart of a message sending method provided by an exemplary embodiment of the present application. This embodiment is described by taking the method being used in a computer device as an example. The method includes the following steps.
[0038] Step 201, send a target message to the receiving end through the TCP long connection.
[0039] Among them, the TCP long connection refers to the process of sending multiple messages based on the same TCP connection after establishing a connection based on the TCP protocol. In the embodiments of the present application, the target message is first sent to the receiving end by using the TCP long connection. The target message can be a text message, an audio message, a picture message, etc., and this embodiment does not limit this.
[0040] Optionally, during the process of sending the message, the message can be sent based on the protocol corresponding to the target application program. Among them, the target application program refers to the client for message sending, and the protocol corresponding to it can be a protocol with a custom data sending format. Or, other protocols can be used for message sending, such as the Hyper Text Transfer Protocol (HTTP).
[0041] Optionally, the receiving end may be the background server corresponding to the client or another computer device, and this embodiment does not limit this.
[0042] Step 202, in response to the failure of sending the target message and the absence of a QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol.
[0043] When sending a message to the receiving end based on a TCP long connection, since the TCP long connection is established based on the TCP protocol, and when sending a message based on the TCP long connection, in a weak network environment, it is prone to serious head-of-line blocking, affecting the sending of the message. Therefore, in a possible implementation manner, after sending the target message based on the long connection, first determine whether the target message is sent successfully. If the sending fails, stop sending the target message to the receiving end through the long connection and switch to use other protocols to ensure the successful sending of the message.
[0044] Optionally, it may be determined whether the target message is sent successfully according to the sending result of the target message within a fixed time threshold. When the target message has not been sent successfully within the fixed time threshold, it is determined that the target message sending fails. For example, if the target message has not been sent successfully within 5 minutes, it is determined that the target message sending fails. And it may also be determined whether the target message is sent successfully according to whether the receiving end receives the target message or the parsing result of the target message after receiving the target message. If the parsing fails, it is determined that the target message sending fails.
[0045] In the embodiment of the present application, when the sending of the target message based on the TCP long connection fails, other protocols may be switched to send the target message. Since the QUIC protocol does not have the head-of-line blocking problem, therefore, the QUIC protocol may be switched to use. However, there may be a situation where the QUIC protocol is unavailable in the current network environment. Therefore, first determine whether there is a QUIC evaluation result corresponding to the current network environment, and then determine the availability of the QUIC protocol based on the QUIC evaluation result.
[0046] In the absence of a QUIC evaluation result, the availability of the QUIC protocol cannot be determined. And since the QUIC protocol does not need to establish a connection first, the target message can be directly sent to the receiving end based on the QUIC protocol, which is convenient for generating a QUIC evaluation result according to the message sending situation of the target message.
[0047] Optionally, the current network environment is determined according to the network unique identifier. For example, for Wireless Fidelity (WiFi), it may be determined according to the unique WiFi identifier Basic Service Set Identifier (BSSID).
[0048] Step 203: Generate a QUIC evaluation result corresponding to the current network environment based on the message sending situation of the target message under the QUIC protocol.
[0049] Optionally, after sending the target message based on the QUIC protocol, the terminal obtains the message sending situation of the target message. Among them, the message sending situation may include two cases: successful message sending or failed message sending. And different QUIC evaluation results can be generated for different message sending situations.
[0050] In a possible implementation manner, after obtaining the QUIC evaluation result corresponding to the current network environment, the current network environment and the QUIC evaluation result can be stored. When sending a message in the same network environment as the current network environment later, the availability of the QUIC protocol can be determined based on the QUIC evaluation result, and then it can be determined whether to switch to use the QUIC protocol for message sending.
[0051] In summary, in the embodiments of the present application, first, a message is sent to the receiving end through a TCP long connection. When the message sending through the TCP long connection fails, the protocol is replaced, and the message is sent to the receiving end based on the QUIC protocol, which helps to improve the message sending success rate; and before sending the message to the receiving end based on the QUIC protocol, it is determined whether there is a QUIC evaluation result corresponding to the current network environment. When there is none, the message can be sent to the receiving end based on the QUIC protocol, and then, according to the message sending situation of the message, a QUIC evaluation result corresponding to the current network environment is generated to determine the availability of the QUIC protocol in the current network environment, which helps to improve the message sending success rate.
[0052] In a possible implementation manner, in the process of generating a QUIC evaluation result based on the message sending situation, when the message is sent successfully, it is necessary to further determine whether the QUIC protocol is available according to the sending parameters; when the message sending fails, the reason for the sending failure needs to be determined, including network reasons, UDP protocol disabling reasons, and other reasons, etc. Different QUIC evaluation results can be generated for different reasons. The following will be described with exemplary embodiments.
[0053] Please refer to Figure 3 , which shows a flowchart of a message sending method provided by another exemplary embodiment of the present application. This embodiment is described by taking the method being used in a computer device as an example. The method includes the following steps.
[0054] Step 301: Send a target message to the receiving end through a TCP long connection.
[0055] Step 302: In response to the failure of sending the target message and the absence of a QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol.
[0056] The implementation manners of Steps 301 to 302 may refer to the above-mentioned Steps 201 to 202, and will not be elaborated in this embodiment.
[0057] Step 303: In response to the indication of the message sending situation that the target message is successfully sent, obtain the message sending parameters.
[0058] After successfully sending the target message based on the QUIC protocol, since only the current message sending is successful and the availability of the QUIC protocol in the current network environment cannot be specifically determined, the message sending parameters will be obtained after the target message is successfully sent.
[0059] Optionally, the computer device may store the message sending parameters of m messages sent based on the QUIC protocol, where the m messages refer to all messages sent based on the QUIC protocol in the current network environment.
[0060] Step 304: Generate a QUIC evaluation result based on the message sending parameters.
[0061] Optionally, the message sending parameters include at least one of the message sending time or the message sending success rate.
[0062] After the target message is successfully sent, obtain the time consumed for sending the target message. Since the message sending time refers to the average time consumed for successfully sending messages among the m messages, after obtaining the time consumed corresponding to the target message, update the message sending time. For example, before sending the target message based on the QUIC protocol, 5 messages have been successfully sent based on the QUIC protocol in the current network environment, and the average time consumed is 30s. When the target message is sent and the target message is successfully sent, the time consumed for sending the target message is 1min, then update the message sending time to 35s.
[0063] And since the target message is successfully sent, the message sending success rate of the m messages will be changed, so the message sending success rate is also updated. For example, before sending the target message, 8 messages have been sent based on the QUIC protocol in the current network environment, and 5 messages have been successfully sent, and the message sending success rate is 62.5%. When the target message is sent and the message is successfully sent, update the message sending success rate to 66.7%.
[0064] Optionally, a QUIC evaluation result may be generated based on at least one of the message sending time or the message sending success rate. This method may include the following steps:
[0065] Step 1: Determine the availability of the QUIC protocol based on the message sending parameters. There is a negative correlation between the message sending time and the QUIC availability, and a positive correlation between the message sending success rate and the QUIC availability.
[0066] Optionally, when determining the QUIC protocol availability based on the message sending time, since the message sending time refers to the average time-consuming, there is a negative correlation between the message sending time and the QUIC protocol availability. That is, the shorter the message sending time, the higher the QUIC protocol availability. In a possible implementation, the corresponding relationship between the message sending time and the QUIC protocol availability can be stored in the computer device. When the message sending time is determined, the corresponding QUIC protocol availability can be determined.
[0067] Schematically, as shown in Table 1, the corresponding relationship between the message sending time and the QUIC protocol availability is as follows:
[0068] Table 1
[0069] Message sending time QUIC protocol availability 0-20s 100 20-40s 80 40-60s 60 60-80s 40 80-100s 20 Greater than 100 s 0
[0070] Optionally, when determining the QUIC protocol availability based on the message sending success rate, there is a positive correlation between the message sending success rate and the QUIC protocol availability, that is, the higher the message sending success rate, the higher the QUIC protocol availability. Correspondingly, the corresponding relationship between the message sending success rate and the QUIC protocol availability can also be stored in the computer device. After the message sending success rate is determined, the corresponding QUIC protocol availability can be determined.
[0071] Schematically, as shown in Table 2, the corresponding relationship between the message sending success rate and the QUIC protocol availability is as follows:
[0072] Table 2
[0073] Message sending time QUIC protocol availability ≥90% 100 80%-90% 80 70%-80% 60 60%-70% 40 50%-60% 20 Less than 50% 0
[0074] Optionally, the QUIC protocol availability can also be determined based on both the message sending time and the message sending success rate. When determining the QUIC protocol availability based on both of them, the first QUIC protocol availability can be determined according to the message sending time, and the second QUIC protocol availability can be determined according to the message sending success rate. Then, the computer device determines the QUIC protocol availability according to the average value of the first QUIC protocol availability and the second QUIC protocol availability.
[0075] Alternatively, different weights can be assigned to the message sending time and the message sending success rate. The first QUIC protocol availability corresponds to the first weight, and the second QUIC protocol availability corresponds to the second weight, and the QUIC protocol availability is determined by weighting.
[0076] Schematically, in combination with the above example, the message sending time is 30s, the availability of the first QUIC protocol is determined to be 80, and the corresponding weight is 40%; the message sending success rate is 90%, and the availability of the second QUIC protocol is determined to be 100, and the corresponding weight is 60%. Then, the availability of the QUIC protocol can be determined to be 92.
[0077] Step 2: In response to the availability of the QUIC protocol being higher than the available threshold, generate a first evaluation result, where the first evaluation result is used to characterize that the QUIC protocol is available.
[0078] After determining the availability of the QUIC protocol, the availability of the QUIC protocol can be compared with the available threshold. When the availability of the QUIC protocol is higher than the available threshold, it is determined that the QUIC protocol is available, and a first evaluation result is generated.
[0079] Schematically, the available threshold is 85.
[0080] Step 3: In response to the availability of the QUIC protocol being lower than the available threshold, generate a second evaluation result, where the second evaluation result is used to characterize that the QUIC protocol is unavailable.
[0081] When the availability of the QUIC protocol is lower than the available threshold, it is determined that the QUIC protocol is unavailable, and a second evaluation result is generated.
[0082] It should be noted that this embodiment only describes the implementation manners of this step and the above step 2, and does not limit the execution timing.
[0083] Step 305: In response to the message sending situation indicating that the target message sending fails, determine the reason for the sending failure.
[0084] There are various reasons for the failure of sending a message based on the QUIC protocol. For example, the network is not enabled or the UDP protocol is disabled in the current network environment. Since the QUIC protocol is established based on the UDP protocol, when the UDP protocol is disabled, the QUIC protocol is also unavailable, etc. Different QUIC evaluation results can be obtained when the message sending fails due to different reasons. Therefore, in one possible implementation manner, when the target message sending fails, the computer device first determines the reason for the sending failure. Optionally, the computer device determining the reason for the sending failure may include the following steps:
[0085] Step 1: Determine the current network status.
[0086] During the process of sending a target message to the receiving end based on the QUIC protocol, there may be a situation where the target message sending fails. The target message sending failure may be caused by the network being closed, rather than the QUIC protocol being unavailable. Therefore, when the target message sending fails, the current network status is first determined.
[0087] Optionally, the current network state indicates whether the network has started, that is, it detects whether the current network is in an enabled state or a disabled state.
[0088] Step 2: In response to the current network state indicating that the network is not enabled, determine that the reason for the sending failure is a network reason.
[0089] When the current network state is closed, that is, the computer device is in a state where it cannot connect to the network, the target message cannot be sent. Therefore, the availability of the QUIC protocol cannot be determined. At this time, determine that the reason for the sending failure is a network reason.
[0090] In the above case where the current network state indicates that the network is not enabled, the reason for the sending failure can be determined. It is possible that the current network state is in an enabled state. At this time, the reason for the sending failure is not a network reason but other reasons. Therefore, it is necessary to further determine the reason for the sending failure. The above Step 2 can be replaced by the following steps:
[0091] Step 3: In response to the current network state indicating that the network is enabled, update the count value of the failure counter. The failure counter is used to record the consecutive failure times of message sending based on the QUIC protocol.
[0092] In the case where the current network is enabled and the target message sending fails, to further determine whether the QUIC protocol is available, further judgment can be made based on the sending result of sending messages based on the QUIC protocol.
[0093] In a possible implementation, a failure counter is set in the computer device to record the consecutive failure times of message sending based on the QUIC protocol. That is, when the computer device sends a message based on the QUIC protocol, if the message sending fails, the count value of the failure counter is updated and incremented by 1. After the failure counter is updated, if the computer device fails to send a message again when sending a message based on the QUIC protocol, the failure counter is updated again to record the consecutive failure times. If the subsequent computer device successfully sends a message based on the QUIC protocol, the count value of the failure counter is cleared. After the count value is cleared, if the subsequent message sending based on the QUIC protocol fails, the count value of the failure counter is updated again.
[0094] Step 4: In response to the count value of the failure counter being greater than the counting threshold, determine that the reason for the sending failure is the UDP protocol disabling reason.
[0095] When the count value of the failure counter is greater than the counting threshold, it is determined that the UDP protocol is disabled in the current network, that is, the QUIC protocol is not available in the current network environment. Determine that the reason for the sending failure is the UDP protocol disabling reason. For example, when the count value is greater than 10, determine that the reason for the sending failure is the UDP protocol disabling reason.
[0096] Step 306: Generate a QUIC evaluation result based on the reason for the sending failure.
[0097] For different reasons for the sending failure, different QUIC evaluation results can be generated. Optionally, generating a QUIC evaluation result based on the reason for the sending failure may include the following situations:
[0098] I. In response to the reason for the sending failure being a network reason, generate a first evaluation result, where the first evaluation result is used to indicate that the QUIC protocol is available.
[0099] When the reason for the sending failure is a network reason, it indicates that the message sending fails because the computer device is in a non-networked state, which has nothing to do with the QUIC protocol. Therefore, a first evaluation result is generated.
[0100] In this case, the computer device can restart the network. In the network-enabled state, it can resend the target message to the receiving end based on the QUIC protocol, and then further evaluate the availability of the QUIC protocol according to the message sending situation of the target message.
[0101] II. In response to the reason for the sending failure being the reason for UDP protocol disabling, generate a second evaluation result, where the second evaluation result is used to indicate that the QUIC protocol is unavailable.
[0102] When the reason for the sending failure is the reason for UDP protocol disabling, it indicates that the UDP protocol is disabled in the current network environment, and the corresponding QUIC protocol is unavailable. Therefore, the computer device generates a second evaluation result.
[0103] Optionally, after the computer device generates a QUIC evaluation result according to the determined reason for the sending failure, it can store the QUIC evaluation result for subsequent use.
[0104] It should be noted that since the sending of the target message based on the QUIC protocol fails currently, and after evaluating that the QUIC protocol is unavailable, the target message can be resent through the TCP short connection method, that is, after generating the second evaluation result, the target message is sent to the receiving end through the TCP short connection to ensure the message sending success rate.
[0105] In this embodiment, when generating a QUIC evaluation result based on the message sending situation of the target message, if the message sending is successful, the message sending time is further obtained, and the availability of the QUIC protocol is determined according to the message sending time to ensure the evaluation accuracy.
[0106] When the message sending fails, the reason for the message sending failure can be further determined, and the availability of the QUIC protocol is evaluated according to the specific reason to ensure the evaluation accuracy.
[0107] In the above embodiments, when there is no QUIC evaluation result corresponding to the current network environment, the method of generating a QUIC evaluation result based on the message sending situation of the target message under the QUIC protocol is introduced. When there is a QUIC evaluation result corresponding to the current network environment, the method of sending the target message can be determined according to the QUIC protocol availability indicated in the QUIC evaluation result. The following will be described by way of exemplary embodiments.
[0108] Please refer to Figure 4 , which shows a flowchart of a message sending method provided by another exemplary embodiment of the present application. This embodiment is described by taking the method being used in a computer device as an example. The method includes the following steps.
[0109] Step 401, send a target message to the receiving end through a TCP long connection.
[0110] The implementation manner of this step can refer to step 201 above, and will not be elaborated in this embodiment.
[0111] Step 402, in response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the first evaluation result, send the target message to the receiving end based on the QUIC protocol.
[0112] In a possible implementation manner, there may be a process of sending a target message to the receiving end based on the QUIC protocol in a network environment that is the same as the current network environment in history. During this process, a QUIC evaluation result corresponding to this network environment will be generated. Therefore, when the target message sending fails, the computer device determines whether there is a QUIC evaluation result corresponding to the current network environment stored.
[0113] Optionally, the computer device can query whether there is a corresponding QUIC evaluation result based on the unique identifier corresponding to the current network environment.
[0114] Optionally, the QUIC evaluation result includes a first evaluation result and a second evaluation result. Among them, the first evaluation result is used to indicate that the QUIC protocol is available in the current network environment. Therefore, when it is determined that the QUIC evaluation result corresponding to the current network environment is the first evaluation result, the target message can be sent to the receiving end based on the QUIC protocol, improving the message sending success rate.
[0115] Step 403, in response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the second evaluation result, send the target message to the receiving end through a TCP short connection.
[0116] Optionally, the second evaluation result indicates that the QUIC protocol is unavailable in the current network environment. Therefore, when there is a QUIC evaluation result corresponding to the current network environment and it is the second evaluation result, it indicates that the target message cannot be sent based on the QUIC protocol, and the target message needs to be sent to the receiving end again through other means.
[0117] In a possible implementation manner, when the QUIC protocol is unavailable, the target message can be sent to the receiving end through a TCP short connection.
[0118] Among them, a TCP short connection means that only one message can be sent through the established TCP channel. When the receiving end receives the target message, the current TCP connection will be disconnected. If a subsequent message needs to be sent, a TCP connection needs to be re-established to send the subsequent message. Optionally, when the computer device sends the target message to the receiving end through a TCP short connection, the target message can be sent to the receiving end based on the HTTP1.1 protocol or the HTTP2 protocol.
[0119] Schematically, taking the target message sending client as WeCom and the receiving end as the WeCom server as an example. As Figure 5 shown, WeCom will include a long connection module 501 and a short connection module 502. When the TCP long connection module is unavailable, the QUIC protocol in the short connection module will be switched. If the QUIC protocol is unavailable, the TCP short connection will be switched, that is, the target message will be sent using the HTTP1.1 or HTTP2 protocol to ensure the successful sending of the message.
[0120] Step 404, determine the evaluation reason, and the evaluation reason is used to indicate the reason why the QUIC evaluation result is the second evaluation result.
[0121] In the case where the QUIC evaluation result corresponding to the current network environment is the second evaluation result, it may be caused by the current network environment disabling the UDP protocol, and the current network environment may not disable the UDP protocol for a long time. Therefore, in a possible implementation manner, when the reason for the second evaluation result of the QUIC evaluation result is the UDP protocol disabling reason, it is possible to detect whether the UDP protocol is disabled at fixed intervals, and then update the evaluation result.
[0122] The QUIC evaluation result being the second evaluation result may be due to the UDP protocol disabling reason, or it may be due to a low message sending success rate or a high latency. Therefore, when there is a QUIC evaluation result corresponding to the current network environment and the QUIC evaluation result is the second evaluation result, first determine the evaluation reason.
[0123] Optionally, when the computer device stores the evaluation result corresponding to the current network environment, if the evaluation result is the second evaluation result, the evaluation reason can be stored accordingly for subsequent use.
[0124] Step 405, in response to the evaluation reason being the UDP protocol disabling reason, based on the target period, periodically send UDP data to the receiving end based on the UDP protocol, and the QUIC protocol is established based on the UDP protocol.
[0125] After determining that the evaluation reason is the UDP protocol disabling reason, the computer device can periodically send UDP data to the receiving end for detection according to the target period, and then determine whether the UDP protocol is disabled in the current network environment based on whether the UDP data is successfully sent. For example, send UDP data to the receiving end for detection every 12 hours.
[0126] Step 406, in response to the successful sending of the UDP data, update the second evaluation result to the first evaluation result.
[0127] When the UDP data is successfully sent, it indicates that the disabling of the UDP protocol in the current network environment has been lifted. In the current network environment, messages can be sent based on the QUIC protocol. Therefore, the computer device can update the second evaluation result back to the first evaluation result.
[0128] In another possible implementation, when the QUIC evaluation result is the first evaluation result, the UDP protocol may not always be available in the current network environment. Therefore, when the QUIC is marked as the first evaluation result, UDP data can also be periodically sent to the receiving end every target period. When there is a failure in sending the UDP data, the first evaluation result can be updated to the second evaluation result. Among them, to further ensure the evaluation accuracy, when multiple consecutive UDP data are all sent failed, the computer device updates the first evaluation result to the second evaluation result.
[0129] In this embodiment, when the target message fails to be sent based on the TCP long connection, the QUIC protocol evaluation result corresponding to the current network environment will be obtained first. When the QUIC protocol is available, the target message is sent to the receiving end based on the QUIC protocol; when the QUIC protocol is not available, the target message is sent to the receiving end again through the TCP short connection, realizing the dynamic switching of the protocol. On the one hand, it avoids the head-of-line blocking problem when sending messages based on the TCP long connection in a weak network environment, and on the other hand, it avoids the situation where the current network environment does not support the QUIC protocol and leads to the inability to transmit messages, ensuring the successful sending of the target message.
[0130] And in this embodiment, when the QUIC evaluation result is the second evaluation result and the evaluation reason is the UDP protocol disabling reason, the QUIC evaluation result is updated according to the sending result of the UDP data by periodically sending UDP data to the receiving end, ensuring the timeliness of the QUIC evaluation result corresponding to the network environment stored in the computer device.
[0131] In a possible implementation, when sending a target message to a receiving end via a long TCP connection, it is first necessary to establish a TCP connection. During the process of establishing the TCP connection, there may be a situation where the connection establishment fails. Correspondingly, it is impossible to send the target message to the receiving end via the long TCP connection. Therefore, when the TCP connection establishment fails, the protocol also needs to be switched.
[0132] Optionally, step 201 may further include the following steps:
[0133] Step 1: Establish a TCP connection with the receiving end.
[0134] During the process of establishing the TCP connection, the computer device first sends a port opening request to the receiving end, and then conducts a three-way handshake process with the receiving end to complete the establishment of the TCP connection.
[0135] Step 2: In response to the successful establishment of the TCP connection, send the target message to the receiving end via the long TCP connection under the TCP channel.
[0136] After the TCP connection is successfully established, the computer device can perform data transmission based on the established TCP channel, that is, the computer device can send a message to the receiving end.
[0137] When the TCP connection establishment fails, first determine the QUIC evaluation result of the current network environment. Optionally, in response to the failure of the TCP connection establishment and the absence of the QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol. The computer device then generates a QUIC protocol evaluation result based on the message sending situation of the target message. The implementation manner of generating the QUIC protocol evaluation result can refer to the above embodiments and will not be elaborated here.
[0138] Furthermore, when the TCP connection establishment fails and there is a QUIC evaluation result corresponding to the current network environment, determine the way to send the target message according to the QUIC evaluation result, which can also refer to the above embodiments and will not be elaborated here.
[0139] In a possible implementation, the client sending the target message may not have the QUIC function enabled. If the client does not have the QUIC function enabled, it is impossible to send the target message to the receiving end based on the QUIC protocol. Therefore, after the failure of sending the target message based on the long TCP connection, first determine whether the QUIC function is enabled currently. When the QUIC function is in the enabled state, then determine the protocol evaluation result of the QUIC protocol in the current network environment. The following will be described with an exemplary embodiment.
[0140] Please refer to Figure 6, which shows a flowchart of a message sending method provided by another exemplary embodiment of the present application. This embodiment is described by taking the method being used in a computer device as an example, and the method includes the following steps.
[0141] Step 601, send a target message to the receiving end through a TCP long connection.
[0142] The implementation manner of this step can refer to the above steps 301 to 302, and will not be elaborated in this embodiment.
[0143] Step 602, in response to the failure of sending the target message and the QUIC function being in an enabled state, determine the QUIC evaluation result corresponding to the current network environment.
[0144] After the failure of sending the target message, the computer device first determines whether the current QUIC function is in an enabled state. Herein, the QUIC function refers to the function of sending messages based on the QUIC protocol.
[0145] In a possible scenario, there is a setting control corresponding to the QUIC function in the computer device, and the user can enable or disable the QUIC function through the setting operation on this setting control, that is, determine whether the QUIC function is supported according to the setting operation corresponding to the QUIC function.
[0146] Optionally, in response to receiving a QUIC function enabling operation, determine that the QUIC function is in an enabled state. In response to receiving a QUIC function disabling operation, determine that the QUIC function is in a disabled state.
[0147] Among them, both the enabling operation and the disabling operation can be operations on the setting control, but the corresponding ways of the operations are different. For example, the enabling operation is a left - swipe operation on the setting control, while the disabling operation is a right - swipe operation on the setting control.
[0148] Optionally, when the QUIC function is in a disabled state, the computer device can also display a prompt message to prompt the user whether to enable the QUIC function.
[0149] In another possible scenario, the server corresponding to the client that sends the target message may conduct a gray - scale test on the QUIC function, and it only opens the QUIC function for the clients used by some user accounts.
[0150] Optionally, in response to receiving a QUIC gray - scale enabling notification sent by the server, determine that the QUIC function is in an enabled state, and the QUIC gray - scale enabling notification is used to indicate that a QUIC gray - scale test is being conducted.
[0151] Among them, the QUIC gray-scale activation notice is the notice sent by the server to the selected user accounts to activate the QUIC function, indicating to conduct the gray-scale test of the QUIC function. When the computer device confirms that it has historically received the QUIC gray-scale activation notice sent by the server, it determines that the QUIC function is opened by the server, and thus determines that the QUIC function is in the activated state; when it has not historically received the QUIC gray-scale activation notice sent by the server, it determines that the QUIC function is not supported, that is, the QUIC function is in the closed state.
[0152] Illustratively, taking the client as WeCom and the server as the WeCom server as an example, for the WeCom to enable the QUIC function, a gray-scale test method is adopted. The WeCom server controls whether the WeCom client activates the QUIC function through a gray-scale switch. It only sends the QUIC gray-scale activation notice to the clients corresponding to some user accounts and activates the QUIC function of the WeCom for which the gray-scale test is conducted.
[0153] When the computer device determines that the QUIC function of the client currently sending the target message is in the activated state, it can determine the QUIC evaluation result corresponding to the current network environment.
[0154] Step 603, in response to the non-existence of the QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol.
[0155] The implementation manner of this step can refer to the above step 202, and will not be elaborated in this embodiment.
[0156] Step 604, in response to the failure of sending the target message and the QUIC function being in the closed state, send the target message to the receiving end through a TCP short connection.
[0157] When the computer device determines that the QUIC function is in the closed state, it is unable to send the target message to the receiving end based on the QUIC protocol. Therefore, there is no need to determine the protocol evaluation result of the QUIC protocol, and the target message is directly sent to the receiving end through a TCP short connection.
[0158] In this embodiment, since there are cases where some clients activate the QUIC function, therefore, before determining the protocol evaluation result of the QUIC protocol, it is first determined whether the current QUIC function has been activated. If it is in the activated state, the QUIC evaluation result is continued to be determined. If it is in the closed state, the target message is directly sent to the receiving end through a TCP short connection, improving the efficiency of evaluating the protocol availability.
[0159] Combined with the above embodiments, in a possible implementation manner, the message sending process is as Figure 7 shown:
[0160] Step 701, determine whether the TCP connection is successfully established; if successful, execute Step 702, if failed, execute Step 704.
[0161] Step 702, send the target message based on the TCP long connection.
[0162] Step 703, determine whether the message is successfully sent; if successful, end, if failed, execute Step 704.
[0163] Step 704, determine whether the QUIC function is supported; if supported, execute Step 705, if not supported, execute Step 713.
[0164] Step 705, determine whether there is a QUIC evaluation result corresponding to the current network environment; if exists, execute Step 706, if not exists, execute Step 707.
[0165] Step 706, determine whether the QUIC protocol is available according to the QUIC evaluation result; if available, execute Step 707, and after executing Step 707, end the process; if not available, execute Step 713.
[0166] Step 707, send the target request based on the QUIC protocol.
[0167] Step 708, determine whether the target request is successfully sent; if successful, execute Step 709, if failed, execute Step 711 and Step 713.
[0168] Step 709, obtain the message sending time.
[0169] Step 710, generate a QUIC evaluation result based on the message sending time.
[0170] Step 711, determine the reason for the sending failure.
[0171] Step 712, generate a QUIC evaluation result based on the reason for the sending failure.
[0172] Step 713, send the target message through the TCP short connection.
[0173] When using the solution provided in the above embodiment for message sending, the success rate and efficiency of message sending in a weak network environment can be improved. Taking the enterprise WeChat client as an example of the client, a comparison will be made between sending messages by switching only between the TCP long connection and the TCP short connection, and sending messages after accessing the QUIC protocol. In both cases, when sending the same message to the same group using different accounts in the same network environment, the test results are shown in Table 3:
[0174] Table 3
[0175]
[0176] When testing by sending the same message to the same account in the same network environment, the test results are shown in Table 4:
[0177] Table 4
[0178]
[0179]
[0180] As shown in Table 3 and Table 4, when in the same weak network environment (i.e., the network parameters are 100 - 80 periodic packet loss and 6000ms jitter), after accessing the QUIC protocol, when sending a message, compared with sending a message only through a TCP long connection, the message sending success rate is increased, and the time consumption is correspondingly reduced. It can be seen that compared with the message sending scheme in the related art, the present solution can improve the message sending success rate and efficiency.
[0181] Figure 8 It is a structural block diagram of a message sending device provided by an exemplary embodiment of the present application. As shown in the figure, the device includes:
[0182] A first sending module 801, configured to send a target message to a receiving end through a TCP long connection;
[0183] A second sending module 802, configured to, in response to the failure of sending the target message and the absence of a QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol;
[0184] A generating module 803, configured to generate the QUIC evaluation result corresponding to the current network environment based on the message sending situation of the target message under the QUIC protocol.
[0185] Optionally, the generating module 803 includes:
[0186] An obtaining unit, configured to, in response to the message sending situation indicating that the target message is successfully sent, obtain message sending parameters, where the message sending parameters are used to indicate the message sending situation of m messages, the m messages are messages sent based on the QUIC protocol in the current network environment, and the m messages include the target message;
[0187] A first generating unit, configured to generate the QUIC evaluation result based on the message sending time.
[0188] Optionally, the message sending parameter includes at least one of a message sending time or a message sending success rate. The message sending time is the average time taken for successfully sent messages among the m messages, and the message sending success rate is the success rate of sending the m messages.
[0189] Optionally, the first generating unit is further configured to:
[0190] Determine the availability of the QUIC protocol based on the message sending parameter. The message sending time has a negative correlation with the QUIC availability, and the message sending success rate has a positive correlation with the QUIC availability;
[0191] In response to the QUIC protocol availability being higher than an available threshold, generate a first evaluation result, where the first evaluation result is used to indicate that the QUIC protocol is available;
[0192] In response to the QUIC protocol availability being lower than the available threshold, generate a second evaluation result, where the second evaluation result is used to indicate that the QUIC protocol is unavailable.
[0193] Optionally, the generating module 803 further includes:
[0194] A first determining unit, configured to determine a reason for sending failure in response to the message sending situation indicating that the target message sending fails;
[0195] A second generating unit, configured to generate the QUIC evaluation result based on the reason for sending failure.
[0196] Optionally, the first determining unit is further configured to:
[0197] Determine the current network state;
[0198] In response to the current network state indicating that the network is not enabled, determine that the reason for sending failure is a network reason;
[0199] Or,
[0200] In response to the current network state indicating that the network is enabled, update the count value of a failure counter, where the failure counter is used to record the consecutive failure times of message sending based on the QUIC protocol; in response to the count value of the failure counter being greater than a count threshold, determine that the reason for sending failure is a UDP protocol disabling reason.
[0201] Optionally, the second generating unit is further configured to:
[0202] In response to the reason for sending failure being the network reason, generate a first evaluation result, where the first evaluation result is used to indicate that the QUIC protocol is available;
[0203] In response to the sending failure reason being the UDP protocol disabling reason, generate a second evaluation result, where the second evaluation result is used to characterize the unavailability of the QUIC protocol.
[0204] Optionally, the device further includes:
[0205] A third sending module, configured to send the target message to the receiving end through a TCP short connection.
[0206] Optionally, the device further includes:
[0207] A fourth sending module, configured to, in response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the first evaluation result, send the target message to the receiving end based on the QUIC protocol;
[0208] Or,
[0209] A fifth sending module, configured to, in response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the second evaluation result, send the target message to the receiving end through a TCP short connection.
[0210] Optionally, the device further includes:
[0211] A first determination module, configured to determine an evaluation reason, where the evaluation reason is used to indicate the reason for the QUIC evaluation result being the second evaluation result;
[0212] A sixth sending module, configured to, in response to the evaluation reason being the UDP protocol disabling reason, periodically send UDP data to the receiving end based on the UDP protocol according to a target period, where the QUIC protocol is established based on the UDP protocol;
[0213] An update module, configured to, in response to the successful sending of the UDP data, update the second evaluation result to the first evaluation result.
[0214] Optionally, the second sending module 803 includes:
[0215] A second determination unit, configured to, in response to the failure of sending the target message and the QUIC function being in an enabled state, determine the QUIC evaluation result corresponding to the current network environment;
[0216] A first sending unit, configured to, in response to the non-existence of the QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol;
[0217] The device further includes:
[0218] A seventh sending module, configured to send the target message to the receiving end through a TCP short connection in response to the failure of sending the target message and the QUIC function being in a closed state.
[0219] Optionally, the apparatus further includes:
[0220] A second determining module, configured to determine that the QUIC function is in an enabled state in response to receiving a QUIC function enabling operation;
[0221] Or,
[0222] A third determining module, configured to determine that the QUIC function is in an enabled state in response to receiving a QUIC gray-scale enabling notification sent by a server, where the QUIC gray-scale enabling notification is used to indicate that a QUIC gray-scale test is to be performed.
[0223] Optionally, the first sending module 801 includes:
[0224] An establishing unit, configured to establish a TCP connection with the receiving end;
[0225] A second sending unit, configured to send the target message to the receiving end through the TCP long connection in the TCP channel in response to the successful establishment of the TCP connection;
[0226] The apparatus further includes:
[0227] An eighth sending module, configured to send the target message to the receiving end based on the QUIC protocol in response to the failure of establishing the TCP connection and the non-existence of the QUIC evaluation result corresponding to the current network environment.
[0228] In summary, in the embodiments of the present application, first, a message is sent to the receiving end through a TCP long connection. When the message sending through the TCP long connection fails, the protocol is replaced and the message is sent to the receiving end based on the QUIC protocol, which helps to improve the message sending success rate; and before sending the message to the receiving end based on the QUIC protocol, it is determined whether there is a QUIC evaluation result corresponding to the current network environment. When there is none, the message can be sent to the receiving end based on the QUIC protocol, and then a QUIC evaluation result corresponding to the current network environment is generated according to the message sending situation of the message, and the availability of the QUIC protocol in the current network environment is determined, which helps to improve the message sending success rate.
[0229] Please refer to Figure 9, which shows a schematic structural diagram of a computer device provided by an exemplary embodiment of the present application. Specifically: The computer device 900 includes a Central Processing Unit (CPU) 901, a system memory 904 including a Random Access Memory 902 and a Read-Only Memory 903, and a system bus 905 connecting the system memory 904 and the central processing unit 901. The computer device 900 further includes a Basic Input / Output System (Input / Output, I / O system) 906 for facilitating the transfer of information between various components within the computer, and a mass storage device 907 for storing an operating system 913, application programs 914, and other program modules 915.
[0230] The basic input / output system 906 includes a display 908 for displaying information and input devices 909 such as a mouse, keyboard, etc. for user input of information. Among them, both the display 908 and the input devices 909 are connected to the central processing unit 901 through an input / output controller 910 connected to the system bus 905. The basic input / output system 906 may further include an input / output controller 910 for receiving and processing inputs from a plurality of other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 910 also provides output to a display screen, printer, or other types of output devices.
[0231] The mass storage device 907 is connected to the central processing unit 901 through a mass storage controller (not shown) connected to the system bus 905. The mass storage device 907 and its associated computer-readable medium provide non-volatile storage for the computer device 900. That is to say, the mass storage device 907 may include a computer-readable medium (not shown) such as a hard disk or a drive.
[0232] Without loss of generality, the computer-readable medium may include a computer storage medium and a communication medium. The computer storage medium includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. The computer storage medium includes random access memory (RAM), read-only memory (ROM), flash memory or other solid-state storage technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic tape cartridges, magnetic tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will understand that the computer storage medium is not limited to the above several types. The above-mentioned system memory 904 and mass storage device 907 can be collectively referred to as memory.
[0233] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 901. The one or more programs include instructions for implementing the above method, and the central processing unit 901 executes the one or more programs to implement the methods provided by the above various method embodiments.
[0234] According to various embodiments of the present application, the computer device 900 can also run by connecting to a remote computer on the network through a network such as the Internet. That is, the computer device 900 can be connected to the network 912 through the network interface unit 911 connected to the system bus 905, or in other words, the network interface unit 911 can also be used to connect to other types of networks or remote computer systems (not shown).
[0235] The memory further includes one or more programs, and the one or more programs are stored in the memory. The one or more programs include steps for the computer device to execute in the method provided by the embodiments of the present application.
[0236] The embodiments of the present application further provide a computer-readable storage medium, in which at least one instruction, at least one program segment, a code set or an instruction set is stored, and the at least one instruction, at least one program segment, the code set or the instruction set is loaded and executed by a processor to implement the message sending method described in any of the above embodiments.
[0237] An embodiment of the present application provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the message sending method provided in the above aspect.
[0238] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, which can be the computer-readable storage medium included in the memory in the above embodiments; or it can exist alone and be a computer-readable storage medium not assembled into the terminal. The computer-readable storage medium stores at least one instruction, at least one segment of program, a code set or an instruction set, and the at least one instruction, the at least one segment of program, the code set or the instruction set are loaded and executed by the processor to implement the message sending method described in any one of the above method embodiments.
[0239] Optionally, the computer-readable storage medium may include: ROM, RAM, solid state drives (SSD), optical discs, etc. Among them, RAM may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0240] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disc, etc.
[0241] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A message sending method, characterized in that, The method includes: Sending a target message to a receiving end through a long TCP connection; In response to the failure of sending the target message and the absence of a QUIC evaluation result corresponding to the current network environment, sending the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol; In response to the indication that the target message is successfully sent under the QUIC protocol, obtaining message sending parameters, where the message sending parameters are used to indicate the message sending situation of m messages, the m messages are messages sent based on the QUIC protocol in the current network environment, and the target message is included in the m messages; Generating the QUIC evaluation result corresponding to the current network environment based on the message sending parameters.
2. The method according to claim 1, wherein The message sending parameters include at least one of message sending time or message sending success rate. The message sending time is the average time taken for successfully sent messages among the m messages, and the message sending success rate is the sending success rate of the m messages; The generating the QUIC evaluation result corresponding to the current network environment based on the message sending parameters includes: Determining the QUIC protocol availability based on the message sending parameters. The message sending time is negatively correlated with the QUIC availability, and the message sending success rate is positively correlated with the QUIC availability; In response to the QUIC protocol availability being higher than an available threshold, generating a first evaluation result, where the first evaluation result is used to characterize that the QUIC protocol is available; In response to the QUIC protocol availability being lower than the available threshold, generating a second evaluation result, where the second evaluation result is used to characterize that the QUIC protocol is unavailable.
3. The method according to claim 1, wherein The method further includes: In response to the indication that the target message is sent unsuccessfully, determining the reason for the sending failure; Generating the QUIC evaluation result based on the reason for the sending failure.
4. The method according to claim 3, characterized in that, The determining the reason for the sending failure includes: Determining the current network state; In response to the current network state indicating that the network is not enabled, determining that the reason for the sending failure is a network reason; Or, In response to the current network state indicating that the network is enabled, updating the count value of a failure counter, where the failure counter is used to record the consecutive failure times of message sending based on the QUIC protocol; in response to the count value of the failure counter being greater than a count threshold, determining that the reason for the sending failure is a UDP protocol disabling reason.
5. The method according to claim 4, wherein The generating the QUIC evaluation result based on the reason for the sending failure includes: In response to the reason for the sending failure being the network reason, generating a first evaluation result, where the first evaluation result is used to characterize that the QUIC protocol is available; In response to the reason for the sending failure being the UDP protocol disabling reason, generating a second evaluation result, where the second evaluation result is used to characterize that the QUIC protocol is unavailable.
6. The method according to claim 5, wherein After generating the second evaluation result, the method further includes: Sending the target message to the receiving end through a short TCP connection.
7. The method according to claim 1, wherein After sending the target message to the receiving end through a long TCP connection, the method further includes: In response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the first evaluation result, sending the target message to the receiving end based on the QUIC protocol; Or, In response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the second evaluation result, sending the target message to the receiving end through a short TCP connection.
8. The method according to claim 7, wherein After sending the target message to the receiving end through a short TCP connection in response to the failure of sending the target message and the QUIC evaluation result corresponding to the current network environment being the second evaluation result, the method further includes: Determining an evaluation reason, where the evaluation reason is used to indicate the reason for the QUIC evaluation result being the second evaluation result; In response to the evaluation reason being the reason for disabling the UDP protocol, periodically sending UDP data to the receiving end based on the UDP protocol at a target period, and the QUIC protocol is established based on the UDP protocol; In response to the successful sending of the UDP data, updating the second evaluation result to the first evaluation result.
9. The method according to any one of claims 1 to 8, characterized in that, Sending the target message to the receiving end based on the QUIC protocol in response to the failure of sending the target message and the non-existence of a QUIC evaluation result corresponding to the current network environment includes: In response to the failure of sending the target message and the QUIC function being in the enabled state, determining the QUIC evaluation result corresponding to the current network environment; In response to the non-existence of the QUIC evaluation result corresponding to the current network environment, sending the target message to the receiving end based on the QUIC protocol; The method further includes: In response to the failure of sending the target message and the QUIC function being in the disabled state, sending the target message to the receiving end through a short TCP connection.
10. The method according to claim 9, characterized in that, The method further includes: In response to receiving a QUIC function enabling operation, determining that the QUIC function is in the enabled state; Or, In response to receiving a QUIC gray-scale enabling notification sent by the server, determining that the QUIC function is in the enabled state, and the QUIC gray-scale enabling notification is used to indicate that a QUIC gray-scale test is to be performed.
11. The method according to any one of claims 1 to 8, characterized in that Sending the target message to the receiving end through a long TCP connection includes: Establishing a TCP connection with the receiving end; In response to the successful establishment of the TCP connection, sending the target message to the receiving end through the long TCP connection under the TCP channel; The method further includes: In response to the failure of establishing the TCP connection and the non-existence of the QUIC evaluation result corresponding to the current network environment, sending the target message to the receiving end based on the QUIC protocol.
12. A message sending device, characterized in that, The device includes: A first sending module, configured to send a target message to a receiving end through a long TCP connection; A second sending module, configured to, in response to the failure of sending the target message and in the absence of a QUIC evaluation result corresponding to the current network environment, send the target message to the receiving end based on the QUIC protocol, where the QUIC evaluation result is used to characterize the availability of the QUIC protocol; A generating module, configured to, in response to an indication that the target message is successfully sent according to the message sending situation of the target message under the QUIC protocol, obtain message sending parameters, where the message sending parameters are used to indicate the message sending situations of m messages, the m messages are messages sent based on the QUIC protocol in the current network environment, and the target message is included in the m messages; and generate the QUIC evaluation result corresponding to the current network environment based on the message sending parameters.
13. A computer device, characterized in that, The computer device includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the message sending method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, At least one instruction, at least one program, a code set, or an instruction set is stored in the readable storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the message sending method according to any one of claims 1 to 11.
15. A computer program product, characterized in that, The computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the message sending method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Event request transmission method and device, storage medium and electronic equipment
CN111885093A