Flow control methods, devices, computer equipment and storage media

By establishing a TCP connection between the client and the gateway, detecting and parsing HTTP protocol requests, and generating target stream objects, the problem of low data transmission efficiency caused by different application layer protocols is solved, achieving efficient data transmission and flow control.

CN116996441BActive Publication Date: 2026-07-17TENCENT TECH (BEIJING) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECH (BEIJING) CO LTD
Filing Date
2022-10-31
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

The increased TCP connection creation time due to the use of different application layer protocols between the client and the server reduces data transmission efficiency.

Method used

By establishing a TCP connection between the client and the gateway, detecting and parsing multiple TCP connection requests, generating a target stream object for an HTTP protocol request, and sending protocol packets to the gateway or target server via the TCP connection, the caching and management of the stream object is achieved.

Benefits of technology

It improves data transmission efficiency, enables traffic control, and allows clients to process multiple HTTP requests in parallel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116996441B_ABST
    Figure CN116996441B_ABST
Patent Text Reader

Abstract

This application discloses a flow control method, apparatus, computer device, and storage medium, belonging to the field of computer technology. The method includes: establishing a TCP connection between a client and a gateway; detecting the TCP connection between the client and the gateway to obtain multiple TCP connection requests; parsing the data in the multiple TCP connection requests to obtain multiple HTTP protocol requests, which are used to request various services from a server; for any HTTP protocol request, generating a target stream object based on the TCP connection, with the object identifier being the protocol header identifier of the HTTP protocol request; and based on the target stream object, sending a first protocol packet to the gateway via the TCP connection, with the gateway forwarding the first protocol packet to the server, the first protocol packet carrying the target data stream converted from the HTTP protocol request. This method can improve data transmission efficiency and achieve flow control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a flow control method, apparatus, computer device, and storage medium. Background Technology

[0002] With the development of internet technology, frequent data interaction is required between the client and the server when users access the internet through a client. For example, when a user browses a webpage using a client, the client sends a data request to the server. The server responds to the data request by returning the corresponding webpage content to the client, which then displays the received webpage content for the user to view. Therefore, how to transmit data efficiently and accurately is a technical problem that needs to be solved.

[0003] In related technologies, different application layer protocols are needed when transferring different types of data between the client and the server. For example, FTP (File Transfer Protocol) is mainly used for transferring remote files, SMTP (Simple Mail Transfer Protocol) is mainly used for transferring emails, and HTTP (Hypertext Transfer Protocol) can be used to transfer any type of data. Furthermore, a connection needs to be established between the client and the server before data transmission. For example, before transmitting HTTP-based data, a TCP (Transmission Control Protocol) connection needs to be established between the client and the server, and data is transmitted based on this TCP connection.

[0004] However, due to differences in application layer protocols, the data interaction methods between the client and server also differ, resulting in the client sending data using different TCP connections for transmission. Furthermore, since creating each TCP connection consumes time, transmitting multiple data sets based on different application protocols increases the time spent establishing TCP connections, leading to reduced data transmission efficiency. Summary of the Invention

[0005] This application provides a flow control method, apparatus, computer device, and storage medium, which improves data transmission efficiency. The technical solution is as follows:

[0006] On the one hand, a flow control method is provided, the method comprising:

[0007] Establish a TCP connection between the client and the gateway;

[0008] The TCP connection between the client and the gateway is detected, and multiple TCP connection requests are obtained;

[0009] The data in the multiple TCP connection requests are parsed to obtain multiple HTTP protocol requests, which are used to request various services in the server.

[0010] For any HTTP protocol request, based on the TCP connection, generate a target stream object whose object identifier is the protocol header identifier of the HTTP protocol request;

[0011] Based on the target stream object, a first protocol packet is sent to the gateway via the TCP connection, and the gateway forwards the first protocol packet to the server. The first protocol packet carries the target data stream converted from the HTTP protocol request, and the server is used to perform business processing based on the first protocol packet.

[0012] In some embodiments, for any HTTP protocol request, generating a target stream object with an object identifier that is the protocol header identifier of the HTTP protocol request based on the TCP connection includes:

[0013] For any HTTP protocol request, if the HTTP protocol request conforms to the proxy rules, a target stream object is generated based on the TCP connection, with the object identifier being the protocol header identifier of the HTTP protocol request. The proxy rules are used to indicate whether data transmission should be performed through the gateway.

[0014] In some embodiments, the method further includes:

[0015] If the HTTP protocol request does not conform to the proxy rules, a temporary connection is created between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP protocol request;

[0016] The data stream obtained from the HTTP protocol request is sent to the target server through the temporary connection.

[0017] The temporary connection is used to receive response data returned by the target server.

[0018] Close the temporary connection.

[0019] On the other hand, a flow control device is provided, the device comprising:

[0020] The first creation module is used to establish a TCP connection between the client and the gateway;

[0021] The request detection module is used to detect the TCP connection between the client and the gateway and obtain multiple TCP connection requests;

[0022] The first parsing module is used to parse the data in the multiple TCP connection requests to obtain multiple HTTP protocol requests, which are used to request various services in the server.

[0023] The first generation module is used to generate a target stream object with the object identifier of the protocol header of the HTTP protocol request, based on the TCP connection, for any HTTP protocol request;

[0024] The first sending module is used to send a first protocol packet to the gateway via the TCP connection based on the target stream object. The gateway then forwards the first protocol packet to the server. The first protocol packet carries a target data stream converted from the HTTP protocol request. The server is used to perform business processing based on the first protocol packet.

[0025] In some embodiments, the first transmitting module includes:

[0026] The first generation unit is configured to, for any HTTP protocol request, generate a first protocol packet with a protocol header identified as the object identifier based on the target stream object, wherein the operation type of the first protocol packet is push type;

[0027] The first writing unit is used to write the length of the target data stream converted from the HTTP protocol request into the protocol header of the first protocol packet, and to write the target data stream converted from the HTTP protocol request into the protocol body of the first protocol packet.

[0028] The first sending unit is configured to send the first protocol packet to the gateway via the TCP connection.

[0029] In some embodiments, the first generation module is configured to, for any HTTP protocol request, generate a second protocol packet whose protocol header is identified by the protocol header identifier of the HTTP protocol request, wherein the operation type of the second protocol packet is creation type and the protocol body is empty; send the second protocol packet to the gateway based on the TCP connection, and the gateway forwards the second protocol packet to the server, wherein the server is configured to generate the target stream object based on the second protocol packet; and generate the target stream object whose object identifier is identified by the protocol header identifier in response to the server not returning error information.

[0030] In some embodiments, the first generation module is configured to, for any HTTP protocol request, search for the target stream object in the cache based on the TCP connection; and if the target stream object is not found, generate the target stream object whose object identifier is the protocol header identifier of the HTTP protocol request.

[0031] In some embodiments, the apparatus further includes:

[0032] A receiving module is configured to receive, via the TCP connection, a third protocol packet returned by the server through the gateway;

[0033] The second parsing module is used to parse the third protocol packet to obtain the operation type, protocol header identifier, and response data of the third protocol packet;

[0034] The lookup module is configured to, in response to the operation type of the third protocol packet being push type, search the cache for the target stream object whose object identifier is the protocol header identifier;

[0035] The writing module is used to write the response data into the cache of the target stream object.

[0036] In some embodiments, the apparatus further includes:

[0037] The second generation module is used to generate a fourth protocol packet for any HTTP protocol request, with the protocol header identifier being the protocol header identifier of the HTTP protocol request. The operation type of the fourth protocol packet is closed and the protocol body is empty.

[0038] The second sending module is used to send the fourth protocol packet to the gateway based on the TCP connection, and the gateway forwards the fourth protocol packet to the server. The server is used to close the target stream object based on the fourth protocol packet.

[0039] The first closing module is used to close the target stream object whose object identifier is the protocol header identifier, and delete the mapping cache between the protocol header identifier of the HTTP protocol request and the target stream object.

[0040] In some embodiments, the first generation module is configured to, for any HTTP protocol request, generate, based on the TCP connection, the target stream object whose object identifier is the protocol header identifier of the HTTP protocol request, provided that the HTTP protocol request conforms to the proxy rules, wherein the proxy rules are used to indicate whether data transmission should be performed through the gateway.

[0041] In some embodiments, the first generation module is further configured to: create a temporary connection between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP protocol request if the HTTP protocol request does not conform to the proxy rules; send the data stream converted from the HTTP protocol request to the target server through the temporary connection; receive the response data returned by the target server through the temporary connection; and close the temporary connection.

[0042] In some embodiments, the apparatus further includes:

[0043] The second creation module is used to establish a TCP connection between the server and the gateway;

[0044] The request receiving module is configured to receive the first protocol packet based on the TCP connection between the server and the gateway;

[0045] The second parsing module is used to parse the first protocol packet to obtain the operation type of the first protocol packet;

[0046] The processing module is configured to respond to the operation type of the first protocol packet being push type, process the service indicated by the target HTTP protocol request carried in the first protocol packet, and obtain response data, wherein the target HTTP protocol is converted from the target stream data carried in the first protocol packet;

[0047] The determination module is used to determine the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request;

[0048] The third sending module is used to send a third protocol packet to the gateway through the TCP connection based on the target stream object. The gateway then forwards the third protocol packet to the client. The third protocol packet carries the response data, and the client displays the response data.

[0049] In some embodiments, the third transmitting module includes:

[0050] The second generation unit is used to generate a third protocol packet with the protocol header identified as the object identifier based on the target stream object, wherein the operation type of the third protocol packet is push type;

[0051] The second writing unit is used to write the length of the response data into the protocol header of the third protocol packet and to write the response data into the protocol body of the third protocol packet.

[0052] The second sending unit is used to send the third protocol packet to the gateway based on the TCP connection.

[0053] In some embodiments, the apparatus further includes:

[0054] The third generation module is used to generate the target stream object based on the TCP connection in response to the operation type of the first protocol packet being creation type.

[0055] In some embodiments, the apparatus further includes:

[0056] The second closing module is used to close the target stream object based on the TCP connection in response to the operation type of the first protocol packet being the closing type, and to delete the mapping cache between the protocol header identifier of the target HTTP protocol request and the target stream object.

[0057] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the flow control method as described above.

[0058] On the other hand, a computer-readable storage medium is provided that stores at least one computer program, which is loaded and executed by a processor to implement the flow control method as described above.

[0059] On the other hand, a computer program product is provided, including a computer program loaded and executed by a processor to implement the flow control method as described above.

[0060] This application provides a flow control method. Since the TCP connection between the client and the gateway is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created through this physical channel. Because each stream is an independent bidirectional sequence used for data interaction between the client and the server within the TCP connection, and each stream does not affect the others, the client can process multiple HTTP requests in parallel based on the multiple streams within the TCP connection. This improves data transmission efficiency and achieves flow control. Attached Figure Description

[0061] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0062] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;

[0063] Figure 2 This is a flowchart of a flow control method provided in an embodiment of this application;

[0064] Figure 3 This is a flowchart of a flow control method provided in an embodiment of this application;

[0065] Figure 4 This is a flowchart of another flow control method provided in the embodiments of this application;

[0066] Figure 5 This is a schematic diagram of a flow control process provided in an embodiment of this application;

[0067] Figure 6 This is a schematic diagram of another flow control process provided in an embodiment of this application;

[0068] Figure 7 This is a schematic diagram of a multiplexing process provided in an embodiment of this application;

[0069] Figure 8 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application;

[0070] Figure 9 This is a schematic diagram of the structure of a flow control device provided in an embodiment of this application;

[0071] Figure 10 This is a schematic diagram of another flow control device provided in an embodiment of this application;

[0072] Figure 11 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;

[0073] Figure 12 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0074] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0075] It is understood that the terms "first," "second," etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of this application, a first protocol packet may be referred to as a second protocol packet, and similarly, a second protocol packet may be referred to as a first protocol packet.

[0076] "At least one" refers to one or more protocols. For example, at least one protocol packet can be one, two, three, or any integer number of protocol packets greater than or equal to one. "Multiple" refers to two or more protocols. For example, multiple protocol packets can be two, three, or any integer number of protocol packets greater than or equal to two. "Each" refers to each of the at least one protocols. For example, each protocol packet refers to every single protocol packet in the multiple protocol packets. If the multiple protocol packets consist of three protocol packets, then each protocol packet refers to every single one of the three protocol packets.

[0077] It is understood that in the embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0078] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application. See also... Figure 1 The implementation environment includes a terminal 101, a gateway 102, and a server 103. The terminal 101 is connected to the gateway 102 via a wireless or wired network, and the gateway 102 is also connected to the server 103 via a wireless or wired network. A client 104 is installed on the terminal 101. This client 104 can be an office application client, a social networking application client, or a game application client, etc. The server 103 provides background services for the client 104. The terminal 101 can perform data transmission, message interaction, and other functions through the client 104.

[0079] In some embodiments, terminal 101 is a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited thereto. Optionally, client 104 is client 104 in the operating system of terminal 101, or client 104 provided by a third party. For example, client 104 is a social application client with instant messaging chat functionality. Of course, the social application can also have other functions, such as group chat functionality, friend-making functionality, etc.

[0080] In some embodiments, server 102 can be an independent physical server, 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 communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 102 is used to provide backend services for applications that support social networking. In some embodiments, server 102 undertakes the main computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the main computing work; or, server 102 and terminal 101 collaborate on computing using a distributed computing architecture.

[0081] In some embodiments, gateway 102 is a router, network switch, network proxy, etc. Gateway 102 enables data interaction between terminal 101 and server 103. Gateway 102 receives data sent by client 104 through terminal 101 and forwards the data to server 103. Alternatively, gateway 102 receives data sent by server 103 and forwards the data to terminal 101 for display by client 104.

[0082] Figure 2 This is a flowchart of a flow control method provided in an embodiment of this application, such as... Figure 2 As shown in the illustration, this application embodiment uses client-side execution as an example. The method includes the following steps:

[0083] 201. Establish a TCP connection between the client and the gateway.

[0084] In this embodiment, a client provided by a server is installed on the terminal, enabling data interaction between the client and the server. This client can be various types, such as a social networking application client, a game application client, or an email client. A communication connection needs to be established between the client and the gateway, through which data interaction between the client and the server is achieved. The gateway is used to forward data between the client and the server. Accordingly, the gateway can receive data sent by the client and forward it to the appropriate server. Alternatively, the gateway can receive response data returned by the server and forward it to the client.

[0085] Before data interaction, the client and server need to establish a TCP connection between the client and the gateway. Based on this TCP connection, data can be transmitted between the client and the gateway. TCP, as a connection-oriented, reliable, byte-stream-based transport layer communication protocol, ensures the stability of data transmission. Since this TCP connection is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created within this physical channel. Each stream is an independent bidirectional sequence used by the client and server for data interaction within this TCP connection. Therefore, based on the multiple streams within this TCP connection, the client can process multiple HTTP requests in parallel. These different HTTP requests can request the same or different services. The server processes the data based on the service indicated by the HTTP request and obtains the response data.

[0086] 202. The TCP connection between the client and the gateway is detected, and multiple TCP connection requests are obtained.

[0087] In this embodiment of the application, based on the client's configuration information, a TCP connection detection service can be enabled to detect TCP connection requests.

[0088] 203. Parse the data in multiple TCP connection requests to obtain multiple HTTP protocol requests. These multiple HTTP protocol requests are used to request various services from the server.

[0089] In this embodiment of the application, the data in the TCP connection request is parsed using the HTTP protocol to obtain the HTTP protocol request.

[0090] 204. For any HTTP protocol request, based on the TCP connection, generate a target stream object whose object identifier is the protocol header identifier of the HTTP protocol request.

[0091] In this embodiment, the protocol header identifier is the identifier of the HTTP protocol request header, and different HTTP protocol requests have different protocol header identifiers. The client can create a stream to transmit the HTTP request and generate a stream object corresponding to the HTTP request. Here, the stream is an independent bidirectional sequence used for data interaction between the client and server in a TCP connection. The stream object is used to cache data transmitted through the stream. Accordingly, to associate the HTTP request with the stream object, the protocol header identifier of the HTTP protocol request is used as the object identifier of the stream object. Taking an HTTP request as an example, for ease of description, the stream object corresponding to the HTTP protocol request is referred to as the target stream object. Based on the target stream object, the client can realize the data interaction process of the HTTP protocol request. This data interaction process includes the client sending the HTTP protocol request to the server through a gateway, the server performing business processing based on the HTTP protocol request, obtaining response data, and returning the response data to the client through the gateway.

[0092] 205. Based on the target stream object, the first protocol packet is sent to the gateway via a TCP connection. The gateway then forwards the first protocol packet to the server. The first protocol packet carries the target data stream obtained by converting the HTTP protocol request. The server uses the first protocol packet to perform business processing.

[0093] In this embodiment, the first protocol packet is a data packet generated by the client, comprising a protocol header and a protocol body. The protocol body includes a target data stream converted from an HTTP request, and the protocol header identifier is identical to the object identifier of the target stream object. Accordingly, after the client forwards the first protocol packet to the server via the gateway through the TCP connection, the server can cache the first protocol packet using the target stream object on the server side. Since the HTTP request is used to request a service from the server, and the first protocol packet carries the target data stream converted from the HTTP request, the server can obtain the HTTP request based on the target stream data carried in the first protocol packet, and then process the service indicated by the HTTP request to obtain response data.

[0094] This application provides a flow control method. Since the TCP connection between the client and the gateway is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created through this physical channel. Because each stream is an independent bidirectional sequence used for data interaction between the client and the server within the TCP connection, and each stream does not affect the others, the client can process multiple HTTP requests in parallel based on the multiple streams within the TCP connection. This improves data transmission efficiency and achieves flow control.

[0095] The above Figure 2 The process of sending data on the client side is illustrated below. Figure 3 The illustrated embodiment describes the data processing process on the server side. Figure 3 This is a flowchart of a flow control method provided in an embodiment of this application, such as... Figure 3 As shown in the illustration, this application embodiment uses server execution as an example for explanation. The method includes the following steps:

[0096] 301. Establish a TCP connection between the server and the gateway.

[0097] In this embodiment, before the client and server can interact with each other, a TCP connection needs to be established between the server and the gateway. Based on this TCP connection, data can be transmitted between the server and the gateway. TCP, as a connection-oriented, reliable, byte-stream-based transport layer communication protocol, ensures the stability of data transmission. Since this TCP connection is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created within this physical channel. Each stream is an independent bidirectional sequence used by the client and server for data interaction within this TCP connection. Therefore, based on the multiple streams within this TCP connection, the server can process multiple HTTP requests in parallel and perform processing based on the various services indicated by the multiple HTTP requests to obtain response data. The gateway can receive the response data returned by the server and forward it to the client.

[0098] 302. Based on the TCP connection between the server and the gateway, receive the first protocol packet.

[0099] In this embodiment of the application, the client sends the first protocol packet to the gateway via a TCP connection, and the gateway forwards the first protocol packet to the server.

[0100] 303. Parse the first protocol packet to obtain the operation type of the first protocol packet.

[0101] The server parses the received first protocol packet to obtain its operation type. This operation type indicates the relevant operation the server will perform based on the first protocol packet. Operation types include creation, push, and close. When the operation type is creation, the server generates a target stream object whose object identifier is the protocol header identifier of the first protocol packet. When the operation type is push, the server obtains the protocol body length of the first protocol packet, retrieves data from the protocol body based on this length, and writes this data into the read cache of the target stream object whose object identifier is the protocol header identifier of the first protocol packet. When the operation type is close, the server closes the target stream object whose object identifier is the protocol header identifier of the first protocol packet.

[0102] 304. In response to the operation type of the first protocol packet being push type, the service indicated by the target HTTP protocol request carried in the first protocol packet is processed to obtain response data. The target HTTP protocol is converted from the target stream data carried in the first protocol packet.

[0103] In this embodiment, when the operation type of the first protocol packet is push type, since the first protocol packet carries a target data stream converted from the target HTTP request, the server can convert the target data stream into the target HTTP protocol request. Based on the target HTTP protocol request, the server performs business processing and obtains response data.

[0104] 305. Identify the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request.

[0105] In this embodiment, since the target stream object is transmitted via a stream, and the stream is an independent bidirectional sequence used for data interaction between the client and the server in a TCP connection, the server can implement the data interaction process of the target HTTP protocol request based on the target stream object. Because different streams are used to transmit different HTTP protocol requests, and the stream objects in different streams are independent of each other, the server can determine the target stream object corresponding to the target HTTP protocol request through the protocol header identifier of the target HTTP protocol request. The object identifier of the target stream object is consistent with the protocol header identifier of the target HTTP protocol request.

[0106] 306. Based on the target stream object, a third protocol packet is sent to the gateway via a TCP connection. The gateway then forwards the third protocol packet to the client. The third protocol packet carries response data, which the client uses to display the response data.

[0107] In this embodiment, the third protocol packet is a data packet generated by the server, and the third protocol packet includes a protocol header and a protocol body. The protocol body includes response data obtained by the server based on the first protocol packet's business processing. The protocol header includes a protocol header identifier that matches the object identifier of the target stream object. After the server forwards the third protocol packet to the client via the gateway through the TCP connection, the client can cache the third protocol packet through the target stream object on the client side. Then, the client displays the response data in the third protocol packet.

[0108] This application provides a flow control method. Since the TCP connection between the server and the gateway is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created through this physical channel. Because a stream is an independent bidirectional sequence used for data interaction between the client and the server within this TCP connection, and each stream does not affect the others, the server can process multiple HTTP requests in parallel based on this TCP connection, thereby improving data transmission efficiency and achieving flow control.

[0109] Figure 4 This is a flowchart of another flow control method provided in the embodiments of this application, such as... Figure 4 As shown in the embodiment of this application, taking the interaction between the client, gateway, and server as an example, the method includes the following steps:

[0110] 401. Establish a TCP connection between the client and the gateway.

[0111] In this embodiment, the client can be various types of clients, such as social application clients, game application clients, and email clients. The gateway can be a router, network switch, network proxy, etc. A communication connection needs to be established between the client and the gateway to enable data interaction between the client and the server.

[0112] 402. The TCP connection between the client and the gateway is detected, and multiple TCP connection requests are obtained.

[0113] In this embodiment of the application, based on the client's configuration information, a TCP connection detection service can be enabled to detect TCP connection requests.

[0114] 403. Parse the data in multiple TCP connection requests to obtain multiple HTTP protocol requests. These multiple HTTP protocol requests are used to request various services from the server.

[0115] In this embodiment, since the TCP connection is equivalent to a physical channel, numerous logical channels, i.e., numerous streams, can be created through this physical channel. Since a stream is an independent bidirectional sequence used for data exchange between the client and server within the TCP connection, the client can process multiple HTTP requests in parallel based on the multiple streams within this TCP connection, without needing to create different physical channels for different HTTP requests. The services requested by the different HTTP requests can be the same or different.

[0116] It should be noted that the client provides a proxy rule that indicates whether to transmit through the gateway. The HTTP request may or may not conform to the proxy rule. If the HTTP request does not conform to the proxy rule, proceed with steps (1)-(4) below; if the HTTP request conforms to the proxy rule, proceed with steps 404-407 below.

[0117] (1) If the HTTP protocol request does not conform to the proxy rules, a temporary connection is created between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP protocol request.

[0118] In this embodiment, the proxy rule is used to indicate whether the HTTP request should be transmitted through the gateway. Therefore, if the HTTP request does not conform to the proxy rule, it does not need to be transmitted through the gateway. Instead, the HTTP request is transmitted based on a temporary connection between the client and the target server corresponding to the domain name carried in the HTTP request. This temporary connection is a TCP connection, and the domain name is used to locate the server during data transmission.

[0119] (2) Send the data stream obtained by the HTTP protocol request to the target server through a temporary connection.

[0120] In this embodiment, the client converts the HTTP request into a data stream and sends the data stream to the target server through a temporary connection between the client and the target server. The target server then converts the data stream back into an HTTP request and processes it based on the service indicated by the HTTP request to obtain response data.

[0121] (3) Receive response data returned by the target server through a temporary connection.

[0122] In this embodiment, the target server processes the service indicated by the HTTP protocol request converted from the data stream to obtain response data. This response data is then sent to the client via the temporary connection. The client is used to display the response data.

[0123] (4) Close the temporary connection.

[0124] In this embodiment, after the client receives the response data, the temporary connection is idle. To prevent the temporary connection from continuing to occupy memory resources, the client can close the temporary connection between the client and the target server.

[0125] 404. For any HTTP protocol request, if the HTTP protocol request conforms to the proxy rules, a target stream object is generated based on the TCP connection, with the object identifier being the protocol header identifier of the HTTP protocol request. The proxy rules are used to indicate whether data transmission should be performed through the gateway.

[0126] In this embodiment, the proxy rule is used to indicate whether the HTTP request is transmitted through the gateway. Therefore, if the HTTP request conforms to the proxy rule, the client sends the HTTP request to the gateway, which then forwards it to the server. The client can create a stream to transmit the HTTP request and generate a stream object corresponding to the HTTP request. Here, the stream is an independent bidirectional sequence used for data interaction between the client and server in a TCP connection. The stream object is used to cache the data transmitted through the stream. Accordingly, to associate the HTTP request with the stream object, the HTTP request header identifier is used as the object identifier of the stream object.

[0127] In some embodiments, the client creates a stream based on a TCP connection to transmit the HTTP protocol request. Accordingly, the target stream object is generated through the following steps (1)-(3).

[0128] (1) For any HTTP protocol request, generate a second protocol packet with the protocol header identifier of the HTTP protocol request. The operation type of the second protocol packet is creation type and the protocol body is empty.

[0129] In this embodiment, the second protocol packet carries a protocol header identifier, a protocol body, and an operation type. The protocol header identifier is the header identifier for an HTTP protocol request, the protocol body is empty, and the operation type is a creation type. This creation type instructs the client or server to generate a target stream object corresponding to the HTTP protocol request.

[0130] For example, if the header identifier of the HTTP request is X, then the header identifier of the second protocol packet generated by the client is also X, and the operation type of the second protocol packet is "SYN", that is, the creation type.

[0131] (2) Based on the TCP connection, the second protocol packet is sent to the gateway, and the gateway forwards the second protocol packet to the server. The server is used to generate the target stream object based on the second protocol packet.

[0132] In this embodiment, since the operation type of the second protocol packet is creation type, the protocol header identifier of the second protocol packet is the protocol header identifier of an HTTP protocol request. Therefore, the client sends the second protocol packet to the gateway based on a TCP connection, and the gateway forwards the second protocol packet to the server. The server, in response to the second protocol packet's operation type being creation type, generates a target stream object with the object identifier being the protocol header identifier of the second protocol.

[0133] (3) In response to the server not returning an error message, generate a target stream object with the object identifier of the protocol header.

[0134] In this embodiment, after the client sends the second protocol packet to the gateway, the client, in response to the server not returning any error information, generates a target flow object whose object identifier is the protocol header identifier of the second protocol packet. Wherein, if the server does not return any error information, i.e., does not throw an exception, the client assumes that the server has successfully generated the target flow object based on the second protocol packet, and in this case, the client generates the target flow object.

[0135] In some embodiments, the client first searches for the target stream object in the cache. If the target stream object is not found in the cache, it then generates the target stream object corresponding to the HTTP request. Accordingly, for any HTTP request, the client searches for the target stream object in the cache based on the TCP connection; if the target stream object is not found, the client generates a target stream object whose object identifier is the HTTP request header identifier. This cache is located on the client side, and based on the HTTP request header identifier, the client searches for the target stream object in the cache whose object identifier is the HTTP request header identifier. If the target stream object is found, the client directly retrieves it from the cache; if the target stream object is not found, the client generates a target stream object whose object identifier is the HTTP request header identifier.

[0136] 405. Based on the target stream object, generate a first protocol packet with the object identifier as the protocol header, and the operation type of the first protocol packet is push type.

[0137] In this embodiment of the application, the second protocol packet carries a protocol header identifier and an operation type, wherein the protocol header identifier is the object identifier of the target stream object, and the operation type is a push type.

[0138] For example, if the object identifier of the target stream object is X, then the protocol header identifier of the first protocol packet generated by the client is also X, and the operation type of the first protocol packet is "PSH", that is, push type.

[0139] 406. Write the length of the target data stream obtained from the HTTP protocol request into the protocol header of the first protocol packet, and write the target data stream obtained from the HTTP protocol request into the protocol body of the first protocol packet.

[0140] In this embodiment, the first protocol packet includes a protocol header and a protocol body. The protocol header stores the length of the target data stream converted from the HTTP protocol request, and the protocol body stores the target data stream converted from the HTTP protocol request. Therefore, the client converts the HTTP protocol request into a target data stream, writes the length of the target data stream into the protocol header of the first protocol packet, and writes the target data stream into the protocol body of the first protocol packet.

[0141] For example, the client calculates the length of the target data stream obtained from the HTTP protocol request as N, writes N into the protocol header of the first protocol packet, and writes the target data stream into the protocol body of the first protocol packet.

[0142] 407. Based on the TCP connection between the client and the gateway, send the first protocol packet to the gateway.

[0143] In this embodiment, the client encapsulates the first protocol packet and sends it to the gateway via a TCP connection, which then forwards it to the server. The first protocol packet carries the target data stream obtained from the HTTP request and the length of that target data stream. The server performs business processing based on the first protocol packet to obtain response data.

[0144] In some embodiments, a client can request to close a stream when it does not need to use streaming to transmit the HTTP protocol request. Accordingly, for any HTTP protocol request, the client generates a fourth protocol packet with a header identifier matching the HTTP protocol request header identifier. This fourth protocol packet has a closure operation type and an empty protocol body. Based on a TCP connection, the client sends the fourth protocol packet to the gateway, which forwards it to the server. The server uses the fourth protocol packet to close the target stream object. The client closes the target stream object with the header identifier matching the HTTP protocol request header identifier and deletes the mapping cache between the HTTP protocol request header identifier and the target stream object. The fourth protocol packet carries a header identifier, a protocol body, and an operation type. The header identifier is the HTTP protocol request header identifier, the protocol body is empty, and the operation type is closure. Since this closure type instructs the client or server to close the target stream object corresponding to the HTTP protocol request, the client sends the fourth protocol packet to the gateway via a TCP connection, which forwards it to the server. The server responds to the fourth protocol packet with an operation type of closure and closes the target stream object with the header identifier matching the fourth protocol packet header identifier. Then the client also closes the target stream object whose object is identified by the protocol header identifier of the fourth protocol packet, and deletes the mapping cache between the target stream object and the protocol header identifier of the HTTP protocol request.

[0145] To make the flow control method provided in the embodiments of this application easier to understand, see [link to relevant documentation]. Figure 5 , Figure 5This is a schematic diagram of a flow control process provided according to an embodiment of this application. The data sending process includes the following steps: 501. The client initializes, obtains configuration information from the backend, and saves it in memory. 502. The client creates a connection between the client and the gateway, i.e., a TCP connection. 503. Based on the configuration information, the client starts a detection service for this TCP connection, i.e., starts a local HTTP detection service. 504. When a TCP connection request is detected, the data in the TCP connection request is parsed to obtain an HTTP protocol request. 505. It is determined whether the HTTP protocol request needs to go through a proxy, i.e., whether the HTTP protocol request conforms to the proxy rules. 506. If the HTTP protocol request conforms to the proxy rules, a TCP connection is obtained between the client and the gateway. 507. A stream object is created through the TCP connection, and then, based on the stream object, a protocol packet is sent to the gateway through the TCP connection. The protocol packet carries a data stream converted from the HTTP protocol request. 508. The gateway sends the protocol packet to the server, the server processes the business based on the protocol packet, obtains response data, and returns it to the client. 509. If the HTTP request does not conform to the proxy rules, obtain the business address connection corresponding to the HTTP request. That is, based on the domain name carried in the HTTP request, create a temporary connection between the client and the target server corresponding to the domain name. Through the temporary connection, send the data stream converted from the HTTP request to the target server. The server processes the data according to the business indicated by the HTTP request converted from the data stream and obtains the response data. Then, through the temporary connection, send the response data to the client.

[0146] 408. Establish a TCP connection between the server and the gateway.

[0147] In this embodiment, before the client and server can interact with each other, a TCP connection needs to be established between the server and the gateway. Based on this TCP connection, data can be transmitted between the server and the gateway. The gateway can receive response data returned by the server and forward it to the client.

[0148] 409. Based on the TCP connection between the server and the gateway, forward the first protocol packet to the server.

[0149] In this embodiment, based on the TCP connection between the client and the gateway, the gateway receives the first protocol packet sent by the client. Then, based on the TCP connection between the gateway and the server, the gateway forwards the first protocol packet to the server.

[0150] 410. Parse the first protocol packet to obtain the operation type of the first protocol packet.

[0151] In this embodiment, the client sends a first protocol packet to the gateway via a TCP connection, and the gateway forwards the first protocol packet to the server. The server parses the received first protocol packet to obtain its operation type. The operation type is used to instruct the server to perform corresponding processing.

[0152] In some embodiments, the operation type includes multiple types. Accordingly, when the operation type is a creation type, the server performs the following step (1); when the operation type is a closing type, the server performs the following step (2); and when the operation type is a push type, the server performs the following steps 411 to 415.

[0153] (1) In response to the operation type of the first protocol packet being creation type, a target stream object is generated based on the TCP connection.

[0154] In this embodiment, the first protocol packet carries a protocol header identifier, a protocol body, and an operation type. The protocol header identifier is the header identifier of the target HTTP protocol request, the protocol body is empty, and the operation type is a creation type. Since the creation type instructs the server to generate a target stream object corresponding to the target HTTP protocol request, and this target HTTP protocol request is obtained by converting the target stream data carried in the first protocol packet, the server, in response to the creation type operation of the first protocol packet, generates a target stream object with the object identifier being the protocol header identifier of the first protocol packet, based on the TCP connection.

[0155] (2) In response to the operation type of the first protocol packet being closed, based on the TCP connection, the target stream object is closed and the mapping cache between the protocol header identifier of the target HTTP protocol request and the target stream object is deleted.

[0156] In this embodiment, the first protocol packet carries a protocol header identifier, a protocol body, and an operation type. The protocol header identifier is the header identifier of the target HTTP request, the protocol body is empty, and the operation type is a close type. Since this close type instructs the server to close the target stream object corresponding to the target HTTP request, which is obtained by converting the target stream data carried in the first protocol packet, the server, in response to the close type of the first protocol packet, closes the target stream object whose object identifier is the header identifier of the first protocol packet based on the TCP connection, and deletes the mapping cache between the target stream object and the header identifier of the target HTTP request.

[0157] 411. In response to the operation type of the first protocol packet being push type, the service indicated by the target HTTP protocol request carried in the first protocol packet is processed to obtain response data. The target HTTP protocol is converted from the target stream data carried in the first protocol packet.

[0158] In this embodiment, when the operation type of the first protocol packet is push type, since the first protocol packet carries a target data stream converted from the target HTTP request, the server can convert the target data stream into the target HTTP protocol request. Based on the target HTTP protocol request, the server performs business processing and obtains response data.

[0159] 412. Identify the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request.

[0160] In this embodiment, since the target stream object is transmitted via a stream, and the stream is an independent bidirectional sequence used for data interaction between the client and the server in a TCP connection, the server can implement the data interaction process of the target HTTP protocol request based on the target stream object. Because different streams are used to transmit different HTTP protocol requests, and the stream objects in different streams are independent of each other, the server can determine the target stream object corresponding to the target HTTP protocol request through the protocol header identifier of the target HTTP protocol request. The object identifier of the target stream object is consistent with the protocol header identifier of the target HTTP protocol request.

[0161] 413. Based on the target stream object, generate a third protocol packet with the object identifier as the protocol header, and the operation type of the third protocol packet is push type.

[0162] In this embodiment, the third protocol packet is a data packet generated by the server, and the third protocol packet includes a protocol header and a protocol body. The protocol body includes response data obtained by the server through business processing based on the first protocol packet. The protocol header includes a protocol header identifier that is consistent with the object identifier of the target stream object. The operation type of the third protocol packet is push type.

[0163] For example, if the object identifier of the target stream object is X, then the protocol header identifier of the third protocol packet generated by the server is also X, and the operation type of the first protocol packet is "PSH", that is, push type.

[0164] 414. Write the length of the response data into the header of the third protocol packet, and write the response data into the body of the third protocol packet.

[0165] In this embodiment of the application, the third protocol packet includes a protocol header and a protocol body. The protocol header stores the length of the response data, and the protocol body stores the response data. Therefore, the server converts the HTTP request into a target data stream, writes the length of the target data stream into the protocol header of the first protocol packet, and writes the target data stream into the protocol body of the first protocol packet.

[0166] For example, the server calculates the length of the response data to be N, writes N into the header of the third protocol packet, and writes the response data into the body of the third protocol packet.

[0167] See Figure 6 This application embodiment also provides a schematic diagram of another flow control process. This data processing process includes the following steps: 601. The server starts a TCP / TLS connection detection service. 602. When a successful TCP handshake is detected, it indicates that the TCP connection has been successfully established. 603. Then, a TLS handshake is performed. After a successful handshake: 604. When the server receives a new connection request, it first determines whether the connection request is a multiplexing request. It reads 8 bytes of data from the connection request and attempts to parse it to see if it conforms to the multiplexing protocol header. If the parsing fails, it is determined that it is not a multiplexing request; if the parsing is successful, it is a multiplexing request connection. After the determination is completed, the read 8 bytes of data are rewritten back into the connection request so that subsequent readings of the connection request will not lose the pre-read data. 605. If the connection request is a multiplexing request, the server parses the first data packet in the connection request according to the multiplexing protocol to obtain the operation type of the data packet. If the operation type of the data packet is creation type "SYN", then the server creates a stream object, i.e., a multiplexing object. 606. Then the server checks the channel (TCP connection). 607. It determines whether the data packet was successfully parsed based on the HTTP protocol. 608. If the HTTP request was successfully parsed, the server processes the service indicated by the HTTP request and obtains the response data.

[0168] 415. Based on the TCP connection between the server and the gateway, send the third protocol packet to the gateway.

[0169] In this embodiment, the server encapsulates the third protocol packet and sends it to the gateway via a TCP connection, which then forwards it to the client. This third protocol packet carries response data obtained by the server based on the first protocol packet sent by the client. The client displays this response data for the user to view.

[0170] 416. Based on the TCP connection between the client and the gateway, a third protocol packet is forwarded to the client, and the third protocol packet carries response data.

[0171] In this embodiment, based on the TCP connection between the server and the gateway, the gateway receives a third protocol packet sent by the server. Then, based on the TCP connection between the gateway and the client, the gateway forwards the third protocol packet to the client.

[0172] In some embodiments, the server performs business processing based on the first protocol packet, obtains response data, and returns the response data to the client through a gateway. Correspondingly, the client receives the third protocol packet returned by the server through the gateway via a TCP connection; parses the third protocol packet to obtain the operation type, protocol header identifier, and response data; the client responds to the operation type of the third protocol packet being push type, searches the cache for the target stream object whose object identifier is the protocol header identifier; and writes the response data into the cache of the target stream object. The third protocol packet carries response data, a protocol header identifier, and an operation type. Since the response data is the result of the server performing business processing based on the first protocol packet sent by the client, and the protocol header identifier is the object identifier of the target stream object, and the operation type is push type, the client responds to the operation type being push type, searches the cache for the target stream object whose object identifier is the protocol header identifier of the third protocol packet, and writes the response data of the third protocol packet into the cache of the target stream object.

[0173] This application provides a flow control method that involves interaction between a client, gateway, and server. Through this interaction, the TCP connections between the client and gateway, and between the gateway and server, are equivalent to physical channels. Numerous logical channels, or streams, can be created through these physical channels. Since each stream is an independent bidirectional sequence used for data exchange between the client and server within the TCP connection, and these streams do not affect each other, the client and server can process multiple HTTP requests in parallel based on these multiple streams within the TCP connection. This improves data transmission efficiency and achieves flow control.

[0174] join Figure 7This application also provides a schematic diagram of a multiplexing process. The multiplexing process includes the following steps: 701. The client establishes a TCP connection with the server, or, based on the TCP connection, performs a TLS handshake to create a TLS connection. 702. The client maintains a connection with the server and detects the TCP / TLS connection. 703. When the client or server detects a protocol packet, it parses the data in the protocol packet based on the multiplexing protocol header. 704. The operation type of the protocol packet is obtained. 705. If the operation type is creation type "SYN". 706. The stream object is searched in the cache. If the stream object is found, it is directly retrieved from the cache. 707. If the stream object is not found, a stream object is generated with the object identifier being the protocol header identifier of the protocol packet. 708. If the operation type is push type "PSH", the protocol body length of the protocol packet is obtained. 709. Data is retrieved from the protocol packet based on the protocol body length. 710. The data is written to the read cache of the stream object. 711. When the operation type is "FIN" (close). 712. Search for the stream object in the cache. If the stream object is found, retrieve it directly from the cache and close it. 713. If the stream object is not found, it means that the stream object has already been closed.

[0175] See Figure 8 This application also provides a schematic diagram of an application scenario. In this application environment, applications A, B, and C on the client side all access the enterprise's internal webpage through a gateway. Using the multiplexing connection provided in this application, a long connection is created between the client and the gateway. All requests that need to be proxied in applications A, B, and C are concurrently forwarded to the gateway. After authentication, the gateway forwards the requests to the corresponding business address, thereby accelerating the webpage access speed.

[0176] To more intuitively illustrate the difference between the data transmission scheme provided in this application and the prior art, as shown in Table 1, experiments were conducted under various conditions based on the existing gateway Nginx and the gateway provided in this application to obtain the data transmission rate of the client and the QPS (Queries-per-second) of the server, which can measure the amount of traffic processed within a specified time.

[0177] Table 1

[0178]

[0179] Referring to Table 1, in the first scenario, the gateway type is a gateway, the network latency is 3 milliseconds, the multiplexed connection provided in this application is used, and a TLS connection is established through a handshake. In this case, the server's QPS is 4019 requests / second, and the client's transfer rate is 7677.95 kilobytes / second. In the second scenario, the gateway type is a gateway, the network latency is 3 milliseconds, the multiplexed connection provided in this application is used, but a TLS connection is not established. In this case, the server's QPS is 4326 requests / second, and the client's transfer rate is 8264.32 kilobytes / second. In the third scenario, the gateway type is a gateway, the network latency is 3 milliseconds, the multiplexed connection provided in this application is not used, and a TLS connection is established through a handshake. In this case, the server's QPS is 906 requests / second, and the client's transfer rate is 1731.17 kilobytes / second. In the fourth scenario, with a gateway type of 'gateway', a network latency of 3 milliseconds, and neither the multiplexing connection provided in this application nor a TLS connection being established, the server's QPS is 2276 requests / second, and the client's transfer rate is 4349.30 kilobytes / second. In the fifth scenario, with an Nginx gateway type, a network latency of 3 milliseconds, and without the multiplexing connection provided in this application, a TLS connection is established via handshake, resulting in a server QPS of 1353 requests / second and a client's transfer rate of 2645.23 kilobytes / second. In the sixth scenario, with an Nginx gateway type, a network latency of 3 milliseconds, and without the multiplexing connection provided in this application, a TLS connection is established via handshake, resulting in a server QPS of 2578 requests / second and a client's transfer rate of 5038.22 kilobytes / second. In summary, using the multiplexing connection provided in this application significantly improves both the server's QPS and the client's transfer rate compared to existing technologies. This is because multiplexing allows the client and server to transmit multiple requests in parallel via TCP connections based on multiple stream objects, significantly reducing TCP idle time and thus increasing data transmission efficiency. Furthermore, comparing the first, third, and fifth scenarios—specifically, TLS connection-type requests—the TLS handshake takes longer than TCP; therefore, using multiplexing results in a more significant improvement in server QPS and client throughput compared to not using multiplexing.

[0180] Figure 9 This is a schematic diagram of the structure of a flow control device provided in an embodiment of this application. See also... Figure 9 The device includes: a first creation module 901, a request detection module 902, a first parsing module 903, a first generation module 904, and a first sending module 905.

[0181] The first creation module 901 is used to establish a TCP connection between the client and the gateway;

[0182] The request detection module 902 is used to detect the TCP connection between the client and the gateway and obtain multiple TCP connection requests;

[0183] The first parsing module 903 is used to parse the data in multiple TCP connection requests to obtain multiple HTTP protocol requests, which are used to request various services in the server.

[0184] The first generation module 904 is used to generate a target stream object with the protocol header identifier of the HTTP protocol request based on a TCP connection for any HTTP protocol request;

[0185] The first sending module 905 is used to send a first protocol packet to the gateway via a TCP connection based on the target stream object. The gateway then forwards the first protocol packet to the server. The first protocol packet carries the target data stream converted from an HTTP protocol request. The server uses the first protocol packet to perform business processing.

[0186] This application provides a flow control device. Since the TCP connection between the client and the gateway is equivalent to a physical channel, countless logical channels, i.e., countless streams, can be created through this physical channel. Because a stream is an independent bidirectional sequence used for data interaction between the client and the server in this TCP connection, and each stream does not affect the others, the client can process multiple HTTP protocol requests in parallel based on the multiple streams in this TCP connection, thereby improving the efficiency of data transmission and realizing flow control.

[0187] In some embodiments, Figure 10 This is a schematic diagram of another flow control device provided in an embodiment of this application. See also... Figure 10 The first transmitting module 905 includes:

[0188] The first generation unit 1001 is used to generate a first protocol packet with a protocol header identifier as an object identifier based on a target stream object for any HTTP protocol request, wherein the operation type of the first protocol packet is push type.

[0189] The first writing unit 1002 is used to write the length of the target data stream obtained by the HTTP protocol request into the protocol header of the first protocol packet, and to write the target data stream obtained by the HTTP protocol request into the protocol body of the first protocol packet.

[0190] The first sending unit 1003 is used to send the first protocol packet to the gateway via a TCP connection.

[0191] In some embodiments, please continue to see Figure 10 The first generation module 904 is used to generate a second protocol packet with the protocol header identifier of the HTTP protocol request for any HTTP protocol request. The operation type of the second protocol packet is creation type and the protocol body is empty. Based on the TCP connection, the second protocol packet is sent to the gateway, and the gateway forwards the second protocol packet to the server. The server uses the second protocol packet to generate a target stream object. In response to the server not returning an error message, the target stream object with the object identifier of the protocol header is generated.

[0192] In some embodiments, please continue to see Figure 10 The first generation module 904 is used to, for any HTTP protocol request, search for the target stream object from the cache based on the TCP connection; if the target stream object is not found, generate the target stream object whose object identifier is the protocol header identifier of the HTTP protocol request.

[0193] In some embodiments, please continue to see Figure 10 The device also includes:

[0194] The receiving module 906 is used to receive third protocol packets returned by the server through the gateway via a TCP connection;

[0195] The second parsing module 907 is used to parse the third protocol packet to obtain the operation type, protocol header identifier and response data of the third protocol packet;

[0196] The lookup module 908 is used to look up the target stream object whose object identifier is the protocol header identifier from the cache in response to the operation type of the third protocol packet being push type.

[0197] The write module 909 is used to write response data into the cache of the target stream object.

[0198] In some embodiments, please continue to see Figure 10 The device also includes:

[0199] The second generation module 910 is used to generate a fourth protocol packet with the protocol header identifier of the HTTP protocol request for any HTTP protocol request. The operation type of the fourth protocol packet is the close type and the protocol body is empty.

[0200] The second sending module 911 is used to send the fourth protocol packet to the gateway based on the TCP connection, and the gateway forwards the fourth protocol packet to the server. The server is used to close the target stream object based on the fourth protocol packet.

[0201] The first closing module 912 is used to close the target stream object whose object identifier is the protocol header identifier and delete the mapping cache between the protocol header identifier of the HTTP protocol request and the target stream object.

[0202] In some embodiments, please continue to see Figure 10 The first generation module 904 is used to generate a target stream object with the object identifier of the HTTP protocol request header based on the TCP connection for any HTTP protocol request, provided that the HTTP protocol request conforms to the proxy rules. The proxy rules are used to indicate whether data transmission should be performed through the gateway.

[0203] In some embodiments, please continue to see Figure 10 The first generation module 904 is also used to create a temporary connection between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP protocol request when the HTTP protocol request does not conform to the proxy rules; send the data stream converted from the HTTP protocol request to the target server through the temporary connection; receive the response data returned by the target server through the temporary connection; and close the temporary connection.

[0204] In some embodiments, please continue to see Figure 10 The device also includes:

[0205] The second creation module 913 is used to establish a TCP connection between the server and the gateway;

[0206] The request receiving module 914 is used to receive the first protocol packet based on the TCP connection between the server and the gateway;

[0207] The second parsing module 915 is used to parse the first protocol packet to obtain the operation type of the first protocol packet;

[0208] Processing module 916 is used to respond to the operation type of the first protocol packet being push type, process the service indicated by the target HTTP protocol request carried in the first protocol packet, and obtain response data. The target HTTP protocol is converted from the target stream data carried in the first protocol packet.

[0209] The determination module 917 is used to determine the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request;

[0210] The third sending module 918 is used to send a third protocol packet to the gateway via a TCP connection based on the target stream object. The gateway then forwards the third protocol packet to the client. The third protocol packet carries response data, which the client uses to display the response data.

[0211] In some embodiments, see Figure 10The third transmitting module 918 includes:

[0212] The second generation unit 1004 is used to generate a third protocol packet with the protocol header identifier being the object identifier based on the target stream object, and the operation type of the third protocol packet is push type;

[0213] The second writing unit 1005 is used to write the length of the response data into the protocol header of the third protocol packet and to write the response data into the protocol body of the third protocol packet.

[0214] The second sending unit 1006 is used to send the third protocol packet to the gateway based on the TCP connection.

[0215] In some embodiments, please continue to see Figure 10 The device also includes:

[0216] The third generation module 919 is used to generate a target stream object in response to the operation type of the first protocol packet being creation type, based on a TCP connection.

[0217] In some embodiments, please continue to see Figure 10 The device also includes:

[0218] The second closing module 920 is used to respond to the operation type of the first protocol packet being closing type, based on the TCP connection, to close the target stream object and delete the mapping cache between the protocol header identifier of the target HTTP protocol request and the target stream object.

[0219] It should be noted that the flow control device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the flow control device and the flow control method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0220] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to implement the operations performed in the flow control method of the above embodiments, or to implement the operations performed in the flow control method of the above embodiments.

[0221] In some embodiments, the computer device is provided as a terminal. Figure 11 A schematic diagram of the structure of a terminal 1100 provided in an exemplary embodiment of this application is shown.

[0222] Terminal 1100 includes a processor 1101 and a memory 1102.

[0223] Processor 1101 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1101 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1101 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1101 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1101 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0224] The memory 1102 may include one or more computer-readable storage media, which may be non-transitory. The memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 are used to store at least one computer program, which is used by the processor 1101 to implement the flow control method provided in the method embodiments of this application.

[0225] In some embodiments, the terminal 1100 may also optionally include: a peripheral device interface 1103 and at least one peripheral device. The processor 1101, memory 1102, and peripheral device interface 1103 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1103 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of: a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, and a power supply 1108.

[0226] Peripheral device interface 1103 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1101 and memory 1102. In some embodiments, processor 1101, memory 1102 and peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1101, memory 1102 and peripheral device interface 1103 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0227] The radio frequency (RF) circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1104 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1104 can communicate with other devices via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1104 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.

[0228] Display screen 1105 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1105 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1101 for processing. In this case, display screen 1105 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1105, disposed on the front panel of terminal 1100; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 1100 or in a folded design; in still other embodiments, display screen 1105 may be a flexible display screen, disposed on a curved or folded surface of terminal 1100. Furthermore, display screen 1105 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 1105 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0229] The camera assembly 1106 is used to acquire images or videos. Optionally, the camera assembly 1106 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal 1100, and the rear-facing camera is disposed on the back of the terminal 1100. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1106 may also include a flash. The flash may be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0230] The audio circuit 1107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1101 for processing, or input to the radio frequency circuit 1104 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 1100. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1101 or the radio frequency circuit 1104 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1107 may also include a headphone jack.

[0231] Power supply 1108 is used to power the various components in terminal 1100. Power supply 1108 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 1108 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0232] In some embodiments, the terminal 1100 further includes one or more sensors 1109. The one or more sensors 1109 include, but are not limited to: an acceleration sensor 1110, a gyroscope sensor 1111, a pressure sensor 1112, an optical sensor 1113, and a proximity sensor 1114.

[0233] Accelerometer 1110 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established with terminal 1100. For example, accelerometer 1110 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 1101 can control display screen 1105 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 1110. Accelerometer 1110 can also be used for games or for acquiring user motion data.

[0234] The gyroscope sensor 1111 can detect the orientation and rotation angle of the terminal 1100. The gyroscope sensor 1111 can work in conjunction with the accelerometer sensor 1110 to collect the user's 3D movements on the terminal 1100. Based on the data collected by the gyroscope sensor 1111, the processor 1101 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.

[0235] The pressure sensor 1112 can be disposed on the side bezel of the terminal 1100 and / or on the lower layer of the display screen 1105. When the pressure sensor 1112 is disposed on the side bezel of the terminal 1100, it can detect the user's grip signal on the terminal 1100, and the processor 1101 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 1112. When the pressure sensor 1112 is disposed on the lower layer of the display screen 1105, the processor 1101 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 1105. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0236] An optical sensor 1113 is used to collect ambient light intensity. In one embodiment, the processor 1101 can control the display brightness of the display screen 1105 based on the ambient light intensity collected by the optical sensor 1113. Optionally, when the ambient light intensity is high, the display brightness of the display screen 1105 is increased; when the ambient light intensity is low, the display brightness of the display screen 1105 is decreased. In another embodiment, the processor 1101 can also dynamically adjust the shooting parameters of the camera assembly 1106 based on the ambient light intensity collected by the optical sensor 1113.

[0237] The proximity sensor 1114, also known as the distance sensor, is installed on the front panel of the terminal 1100. The proximity sensor 1114 is used to detect the distance between the user and the front of the terminal 1100. In one embodiment, when the proximity sensor 1114 detects that the distance between the user and the front of the terminal 1100 is gradually decreasing, the processor 1101 controls the display screen 1105 to switch from a screen-on state to a screen-off state; when the proximity sensor 1114 detects that the distance between the user and the front of the terminal 1100 is gradually increasing, the processor 1101 controls the display screen 1105 to switch from a screen-off state to a screen-on state.

[0238] Those skilled in the art will understand that Figure 11 The structure shown does not constitute a limitation on terminal 1100 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0239] In some embodiments, the computer device is provided as a server. Figure 12This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1200 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1201 and one or more memories 1202. The memories 1202 store at least one computer program, which is loaded and executed by the processor 1201 to implement the methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.

[0240] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the operations performed by the flow control method of the above embodiments.

[0241] This application also provides a computer program product, including a computer program loaded and executed by a processor to implement the operations performed by the flow control method of the above embodiments. In some embodiments, the computer program involved in this application can be deployed and executed on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can form a blockchain system.

[0242] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0243] The above are merely optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.

Claims

1. A flow control method, characterized in that, The method includes: Establish a TCP connection between the client and the gateway; The TCP connection between the client and the gateway is detected, and multiple TCP connection requests are obtained; The data in the multiple TCP connection requests are parsed to obtain multiple HTTP protocol requests, which are used to request various services in the server. For any HTTP protocol request, based on the TCP connection, a target stream object is generated with the object identifier of the HTTP protocol request's protocol header identifier. The target stream object is the stream object corresponding to the HTTP protocol request generated by the client after creating the HTTP protocol request stream in the TCP connection. The stream object is used to cache data transmitted through the stream. The stream is an independent bidirectional sequence used by the client and the server for data interaction in the TCP connection, and each stream does not affect the others. The stream is a logical channel, and the client can process multiple HTTP protocol requests in parallel based on multiple streams in the TCP connection. Based on the target stream object, the first protocol packet is sent to the gateway through the TCP connection, and the gateway forwards the first protocol packet to the server. The first protocol packet carries the target data stream converted from the HTTP protocol request. The server is used to perform business processing based on the first protocol packet, and the server is used to cache the first protocol packet through the target stream object on the server side.

2. The method according to claim 1, characterized in that, The step of sending the first protocol packet to the gateway via the TCP connection based on the target stream object includes: For any HTTP protocol request, based on the target stream object, generate a first protocol packet with the header identifier being the object identifier, wherein the operation type of the first protocol packet is push type; The length of the target data stream obtained by the HTTP protocol request is written into the protocol header of the first protocol packet, and the target data stream obtained by the HTTP protocol request is written into the protocol body of the first protocol packet; The first protocol packet is sent to the gateway via the TCP connection.

3. The method according to claim 1, characterized in that, For any HTTP protocol request, generating a target stream object with an object identifier that is the protocol header identifier of the HTTP protocol request based on the TCP connection includes: For any HTTP protocol request, generate a second protocol packet with the protocol header identifier of the HTTP protocol request, wherein the operation type of the second protocol packet is creation type and the protocol body is empty; Based on the TCP connection, the second protocol packet is sent to the gateway, which then forwards the second protocol packet to the server. The server is used to generate the target stream object based on the second protocol packet. In response to the server not returning an error message, the target stream object with the object identifier being the protocol header identifier is generated.

4. The method according to claim 1, characterized in that, For any HTTP protocol request, generating a target stream object with an object identifier that is the protocol header identifier of the HTTP protocol request based on the TCP connection includes: For any HTTP protocol request, the target stream object is retrieved from the cache based on the TCP connection; If the target stream object is not found, the target stream object is generated with the object identifier being the protocol header identifier of the HTTP protocol request.

5. The method according to any one of claims 1-4, characterized in that, After sending the first protocol packet to the gateway via the TCP connection based on the target stream object, the method further includes: Through the TCP connection, the server receives a third protocol packet returned by the gateway. The third protocol packet is parsed to obtain the operation type, protocol header identifier, and response data of the third protocol packet; In response to the operation type of the third protocol packet being push type, the target stream object whose object identifier is the protocol header identifier is retrieved from the cache; The response data is written into the cache of the target stream object.

6. The method according to claim 5, characterized in that, After writing the response data into the cache of the target stream object, the method further includes: For any HTTP protocol request, generate a fourth protocol packet with the protocol header identifier of the HTTP protocol request, wherein the operation type of the fourth protocol packet is closed and the protocol body is empty; Based on the TCP connection, the fourth protocol packet is sent to the gateway, which then forwards the fourth protocol packet to the server. The server is used to close the target stream object based on the fourth protocol packet. Close the target stream object whose object identifier is the protocol header identifier, and delete the mapping cache between the protocol header identifier of the HTTP protocol request and the target stream object.

7. The method according to any one of claims 1-4, characterized in that, The method further includes: Establish a TCP connection between the server and the gateway; Based on the TCP connection between the server and the gateway, the first protocol packet is received; The operation type of the first protocol packet is obtained by parsing the first protocol packet. In response to the fact that the operation type of the first protocol packet is push type, the service indicated by the target HTTP protocol request carried by the first protocol packet is processed to obtain response data, wherein the target HTTP protocol is converted from the target stream data carried by the first protocol packet; Identify the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request; Based on the target stream object, a third protocol packet is sent to the gateway via the TCP connection. The gateway then forwards the third protocol packet to the client. The third protocol packet carries the response data, which the client uses to display.

8. The method according to claim 7, characterized in that, The step of sending a third protocol packet to the gateway via the TCP connection based on the target stream object includes: Based on the target stream object, a third protocol packet with the object identifier in the protocol header is generated, and the operation type of the third protocol packet is push type; Write the length of the response data into the header of the third protocol packet, and write the response data into the body of the third protocol packet; Based on the TCP connection, the third protocol packet is sent to the gateway.

9. The method according to claim 7, characterized in that, After parsing the first protocol packet to obtain the operation type of the first protocol packet, the method further includes: In response to the operation type of the first protocol packet being creation type, the target stream object is generated based on the TCP connection.

10. The method according to claim 7, characterized in that, After parsing the first protocol packet to obtain the operation type of the first protocol packet, the method further includes: In response to the first protocol packet's operation type being closed, the target stream object is closed based on the TCP connection, and the mapping cache between the target HTTP protocol request's header identifier and the target stream object is deleted.

11. The method according to claim 1, characterized in that, For any HTTP protocol request, generating a target stream object with an object identifier that is the protocol header identifier of the HTTP protocol request based on the TCP connection includes: For any HTTP protocol request, if the HTTP protocol request conforms to the proxy rules, a target stream object is generated based on the TCP connection, with the object identifier being the protocol header identifier of the HTTP protocol request. The proxy rules are used to indicate whether data transmission should be performed through the gateway.

12. The method according to claim 11, characterized in that, The method further includes: If the HTTP request does not conform to the proxy rules, a temporary connection is created between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP request. The data stream obtained from the HTTP protocol request is sent to the target server through the temporary connection. The temporary connection is used to receive response data returned by the target server. Close the temporary connection.

13. A flow control device, characterized in that, The device includes: The connection creation module is used to establish a TCP connection between the client and the gateway; The request detection module is used to detect the TCP connection between the client and the gateway and obtain multiple TCP connection requests; The first parsing module is used to parse the data in the multiple TCP connection requests to obtain multiple HTTP protocol requests, which are used to request various services in the server. The first generation module is used to generate, for any HTTP protocol request, a target stream object with an object identifier that is the protocol header identifier of the HTTP protocol request based on the TCP connection. The target stream object is the stream object corresponding to the HTTP protocol request generated by the client after creating the stream of the HTTP protocol request in the TCP connection. The stream object is used to cache data transmitted through the stream. The stream is an independent bidirectional sequence used by the client and the server for data interaction in the TCP connection, and the streams do not affect each other. The stream is a logical channel. The client can process multiple HTTP protocol requests in parallel based on multiple streams in the TCP connection. The first sending module is used to send a first protocol packet to the gateway via the TCP connection based on the target stream object. The gateway then forwards the first protocol packet to the server. The first protocol packet carries a target data stream converted from the HTTP protocol request. The server is used to perform business processing based on the first protocol packet. The server is also used to cache the first protocol packet through the target stream object on the server side.

14. The apparatus according to claim 13, characterized in that, The first sending module includes: The first generation unit is configured to, for any HTTP protocol request, generate a first protocol packet with a protocol header identified as the object identifier based on the target stream object, wherein the operation type of the first protocol packet is push type; The first writing unit is used to write the length of the target data stream converted from the HTTP protocol request into the protocol header of the first protocol packet, and to write the target data stream converted from the HTTP protocol request into the protocol body of the first protocol packet. The first sending unit is configured to send the first protocol packet to the gateway via the TCP connection.

15. The apparatus according to claim 13, characterized in that, The first generation module is used for: For any HTTP protocol request, generate a second protocol packet with the protocol header identifier of the HTTP protocol request, wherein the operation type of the second protocol packet is creation type and the protocol body is empty; Based on the TCP connection, the second protocol packet is sent to the gateway, which then forwards the second protocol packet to the server. The server is used to generate the target stream object based on the second protocol packet. In response to the server not returning an error message, the target stream object with the object identifier being the protocol header identifier is generated.

16. The apparatus according to claim 13, characterized in that, The first generation module is used for: For any HTTP protocol request, the target stream object is retrieved from the cache based on the TCP connection; If the target stream object is not found, the target stream object is generated with the object identifier being the protocol header identifier of the HTTP protocol request.

17. The apparatus according to any one of claims 13-16, characterized in that, The device further includes: A receiving module is configured to receive, via the TCP connection, a third protocol packet returned by the server through the gateway; The second parsing module is used to parse the third protocol packet to obtain the operation type, protocol header identifier, and response data of the third protocol packet; The lookup module is configured to, in response to the operation type of the third protocol packet being push type, search the cache for the target stream object whose object identifier is the protocol header identifier; The writing module is used to write the response data into the cache of the target stream object.

18. The apparatus according to claim 17, characterized in that, The device further includes: The second generation module is used to generate a fourth protocol packet for any HTTP protocol request, with the protocol header identifier being the protocol header identifier of the HTTP protocol request. The operation type of the fourth protocol packet is closed and the protocol body is empty. The second sending module is used to send the fourth protocol packet to the gateway based on the TCP connection, and the gateway forwards the fourth protocol packet to the server. The server is used to close the target stream object based on the fourth protocol packet. The first closing module is used to close the target stream object whose object identifier is the protocol header identifier, and delete the mapping cache between the protocol header identifier of the HTTP protocol request and the target stream object.

19. The apparatus according to any one of claims 13-16, characterized in that, The device further includes: The second creation module is used to establish a TCP connection between the server and the gateway; The request receiving module is configured to receive the first protocol packet based on the TCP connection between the server and the gateway; The second parsing module is used to parse the first protocol packet to obtain the operation type of the first protocol packet; The processing module is configured to respond to the operation type of the first protocol packet being push type, process the service indicated by the target HTTP protocol request carried in the first protocol packet, and obtain response data, wherein the target HTTP protocol is converted from the target stream data carried in the first protocol packet; The determination module is used to determine the target stream object whose object identifier is the protocol header identifier of the target HTTP protocol request; The third sending module is used to send a third protocol packet to the gateway through the TCP connection based on the target stream object. The gateway then forwards the third protocol packet to the client. The third protocol packet carries the response data, and the client displays the response data.

20. The apparatus according to claim 19, characterized in that, The third sending module includes: The second generation unit is used to generate a third protocol packet with the protocol header identified as the object identifier based on the target stream object, wherein the operation type of the third protocol packet is push type; The second writing unit is used to write the length of the response data into the protocol header of the third protocol packet and to write the response data into the protocol body of the third protocol packet. The second sending unit is used to send the third protocol packet to the gateway based on the TCP connection.

21. The apparatus according to claim 19, characterized in that, The device further includes: The third generation module is used to generate the target stream object based on the TCP connection in response to the operation type of the first protocol packet being creation type.

22. The apparatus according to claim 19, characterized in that, The device further includes: The second closing module is used to close the target stream object based on the TCP connection in response to the operation type of the first protocol packet being the closing type, and to delete the mapping cache between the protocol header identifier of the target HTTP protocol request and the target stream object.

23. The apparatus according to claim 13, characterized in that, The first generation module is used for: For any HTTP protocol request, if the HTTP protocol request conforms to the proxy rules, a target stream object is generated based on the TCP connection, with the object identifier being the protocol header identifier of the HTTP protocol request. The proxy rules are used to indicate whether data transmission should be performed through the gateway.

24. The apparatus according to claim 23, characterized in that, The first generation module is further configured to: If the HTTP request does not conform to the proxy rules, a temporary connection is created between the client and the target server corresponding to the domain name based on the domain name carried in the HTTP request. The data stream obtained from the HTTP protocol request is sent to the target server through the temporary connection. The temporary connection is used to receive response data returned by the target server. Close the temporary connection.

25. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to implement the flow control method as described in any one of claims 1 to 12.

26. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the flow control method as described in any one of claims 1 to 12.

27. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to implement the flow control method as described in any one of claims 1 to 12.