Client communication network, network request processing method, electronic device and medium

By introducing the target underlying library into the client communication network, the client communication implementation library and business layer are decoupled from the third-party network library. This solves the maintenance cost and stability problems when the communication network library is replaced in the existing technology, and improves the efficiency and flexibility of network request processing.

CN116471265BActive Publication Date: 2026-03-13BAIDU INT TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

The existing client communication network has a strong dependency on the communication network library, which means that when the communication network library is changed, the client communication implementation library and business layer need to be iterated, increasing maintenance costs and reducing stability.

Method used

By introducing a target underlying library, a custom network request is initiated to the target underlying library through a client communication implementation library. The target underlying library uses a third-party network library to obtain custom response data and sends it to the business layer. The business layer parses the data, thus decoupling the client communication implementation library and the business layer from the third-party network library.

Benefits of technology

It reduces the maintenance cost of the client communication network, improves stability, and eliminates the need for iterative processing of the client communication implementation library and business layer when replacing third-party network libraries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471265B_ABST
    Figure CN116471265B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer technology, specifically to a client communication network, a network request processing method, an electronic device, and a medium. The specific implementation scheme includes: a client communication implementation library for initiating custom network requests to a target underlying library; a target underlying library for obtaining custom response data corresponding to the custom network request using a third-party network library, and sending the custom response data to the business layer; wherein the third-party network library is a communication network library corresponding to the target underlying library; and a business layer for parsing the custom response data to obtain the data parsing result. Using this disclosure can reduce the maintenance cost of the client communication network and improve its stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to a client communication network, a network request processing method, an electronic device, and a medium. Background Technology

[0002] Currently, communication between clients and servers is based on the client communication network installed on the terminal device. However, the business layer of the existing client communication network often has a strong dependency on the communication network library, making it impossible to replace the communication network library without the business side being aware of the change. This increases the maintenance cost of the client communication network and reduces its stability. Summary of the Invention

[0003] This disclosure provides a client communication network, a network request processing method, an electronic device, and a medium.

[0004] According to one aspect of this disclosure, a client communication network is provided, comprising:

[0005] A client communication implementation library used to initiate custom network requests to the target underlying library;

[0006] The target underlying library is used to obtain custom response data corresponding to the custom network request using a third-party network library, and send the custom response data to the business layer; wherein, the third-party network library is a communication network library corresponding to the target underlying library;

[0007] The business layer is used to parse the custom response data and obtain the data parsing result.

[0008] According to a second aspect of this disclosure, a network request processing method is provided, comprising:

[0009] The client communication implementation library initiates a custom network request to the target underlying library;

[0010] The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request, and sends the custom response data to the business layer; wherein, the third-party network library is a communication network library corresponding to the target underlying library;

[0011] The business layer parses the custom response data to obtain the data parsing result.

[0012] According to a third aspect of this disclosure, an electronic device is provided, comprising:

[0013] At least one processor;

[0014] Memory that is communicatively connected to at least one processor;

[0015] The memory stores instructions that can be executed by at least one processor, such that the instructions are executed by at least one processor to enable the at least one processor to perform the method provided in the first aspect.

[0016] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the method provided in the first aspect.

[0017] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method provided in the first aspect.

[0018] Using this disclosure can reduce the maintenance cost of the client communication network and improve its stability.

[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0020] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0021] Figure 1 This is a schematic diagram of a client communication network architecture provided in an embodiment of the present disclosure;

[0022] Figure 2 A schematic diagram of the architecture of a target underlying library provided in an embodiment of this disclosure;

[0023] Figure 3 A schematic diagram illustrating the classification of request subjects provided in this disclosure embodiment;

[0024] Figure 4 This is an extended schematic diagram of a Post request body provided in an embodiment of the present disclosure;

[0025] Figure 5 This is a schematic diagram of the overall flow of a network request processing method provided in an embodiment of the present disclosure;

[0026] Figure 6 A schematic diagram of a monitoring process provided in an embodiment of this disclosure;

[0027] Figure 7 This is a schematic diagram illustrating the definition of custom abnormal data provided in an embodiment of this disclosure;

[0028] Figure 8A schematic diagram of an architecture for multiple candidate underlying libraries provided in an embodiment of this disclosure;

[0029] Figure 9 A schematic diagram illustrating a custom constraint method for a custom network request provided in an embodiment of this disclosure;

[0030] Figure 10 This is a schematic diagram of a custom request process provided in an embodiment of the present disclosure;

[0031] Figure 11 A flowchart illustrating a network request processing method provided in an embodiment of this disclosure;

[0032] Figure 12 This is a schematic diagram illustrating an application scenario of a network request processing method provided in an embodiment of this disclosure;

[0033] Figure 13 This is a schematic structural block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0034] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0035] As described in the background section, currently, communication between clients and servers is based on the client communication network mounted on the terminal device. This client communication network is the client's network architecture, such as the network architecture of an Android client.

[0036] However, existing client communication networks often have a strong dependency between the business layer and the communication network library. Specifically, in existing client communication networks, the client communication implementation library and the business layer typically interact directly with a primary communication network library to directly call its relevant communication interfaces and request sending methods. Therefore, when the primary communication network library needs to be replaced—for example, by replacing it with a second communication network library—both the client communication implementation library and the business layer must undergo iterative processing to match the second library, making it impossible for the business side to be unaware of the change. Since this iterative processing involves significant code modifications, it increases the maintenance cost of the client communication network and reduces its stability.

[0037] Based on this, embodiments of this disclosure provide a client communication network that can be mounted on an electronic device. The following will be combined with... Figure 1 The network architecture diagram shown illustrates a client communication network provided in an embodiment of this disclosure.

[0038] A client communication implementation library used to initiate custom network requests to the target underlying library;

[0039] The target underlying library is used to obtain custom response data corresponding to custom network requests using a third-party network library, and then send the custom response data to the business layer; the third-party network library is the communication network library corresponding to the target underlying library.

[0040] The business layer is used to parse custom response data and obtain the data parsing results.

[0041] Among them, the client communication implementation library can be used to provide an efficient, feature-rich client programming toolkit that supports the Hypertext Transfer Protocol (Http) protocol. In the field of computer technology, it can also be called HttpClient.

[0042] In addition, please combine Figure 2 In this embodiment, the custom network request can be an abstract method defined by the business party that needs to be implemented. It can include three request body categories: for example, it can be an asynchronous request (sendRequest), a synchronous request (performRequest), or a cancel request (cancelRequest). This embodiment does not impose any limitations on this. The target underlying library is used to inherit the implementation class in the third-party network library to process the custom network request. The third-party network library is a communication network library corresponding to the target underlying library, such as the Okhttp network library or the Cronet network library. The Okhttp network library can be implemented using the Java platform, and the Cronet network library can be implemented using the C++ platform. Therefore, the Cronet network library has cross-platform capabilities and supports mobile operating systems such as iOS and Android. Furthermore, the Cronet network library also supports the third-generation Hypertext Transfer Protocol, i.e., HTTP / 3.

[0043] Based on the above description, it can be understood that in this embodiment, after receiving a custom network request initiated by the client communication implementation library, the target underlying library can process the custom network request by inheriting the implementation class in the third-party network library, obtain the custom response data corresponding to the custom network request, and then send the custom response data to the business layer. The business layer then parses the custom response data to obtain the data parsing result. Specifically, the target underlying library can send the custom response data to the business layer through the client communication implementation library.

[0044] The client communication network provided in this embodiment allows a custom network request to be initiated to a target underlying library via its client communication implementation library. The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request and sends this data to the business layer. The business layer parses the custom response data to obtain the parsing result. In this embodiment, because a target underlying library is added between the client communication implementation library and the business layer and the third-party network library, and the target underlying library can use the third-party network library to obtain custom response data corresponding to the custom network request, the client communication implementation library and the business layer do not need to concern themselves with the implementation classes in the third-party network library, thus achieving decoupling between the business side and the third-party network library. Therefore, even when the third-party network library needs to be replaced with another communication network library, no corresponding iterative processing is required for the client communication implementation library and the business layer, ensuring the business side is unaware of the change, thereby reducing the maintenance cost of the client communication network and improving its stability.

[0045] In some specific implementations, the target underlying library is used for:

[0046] Transform custom network requests into standard network requests usable by third-party network libraries;

[0047] Send a standard network request to a third-party network library so that the third-party network library can initiate a standard network request to the server and obtain standard response data returned by the server based on the standard network request;

[0048] Encapsulate standard response data into custom response data corresponding to custom network requests.

[0049] In a specific example, after determining the request type of the custom network request, the custom network request can be transformed according to the request type to obtain a standard network request usable by a third-party network library. The standard network request can then be sent to the third-party network library, which can call the corresponding request processing logic (implementation class) to initiate a standard network request to the server, obtain the standard response data returned by the server based on the standard network request, and return the standard response data to the target underlying library so that the target underlying library can encapsulate the standard response data into custom response data corresponding to the custom network request.

[0050] Standard network requests are network requests defined in third-party network libraries. These libraries have corresponding implementation classes that can be used to process custom network requests.

[0051] Based on the above-mentioned functions of the target underlying library, in this embodiment of the disclosure, a standard network request usable by the third-party network library can be obtained simply by transforming the custom network request through the target underlying library. Subsequently, the standard network request is sent to the third-party network library to initiate a standard network request to the server, obtain standard response data returned by the server based on the standard network request, and then encapsulate the standard response data into custom response data corresponding to the custom network request. This process is simple in logic, short in time, and can improve the working efficiency of the client's communication network.

[0052] In some specific implementations, the target underlying library is specifically used to implement the following functions to transform custom network requests into standard network requests available to third-party network libraries:

[0053] Parse the custom network request to obtain the request type and request data structure;

[0054] If it is determined that the request type belongs to a type supported by the third-party network library, determine the standard request structure corresponding to the request type in the third-party network library;

[0055] Based on the standard request structure, the request data structure is transformed to obtain the standard network request that is available to third-party network libraries.

[0056] In this embodiment of the disclosure, the purpose of parsing the custom network request is to obtain the request type and request data structure of the custom network request.

[0057] The request type can include request subject classification and request method. Furthermore, as mentioned above, in this embodiment of the disclosure, a custom network request can include three request subject classifications—asynchronous request (sendRequest), synchronous request (performRequest), and cancel request (cancelRequest).

[0058] Please combine Figure 3 For each category of custom network requests, there may be at least three request methods: GET request (HttpGetRequest), POST request (HttpPostRequest), and HEAD request (HttpHeadRequest). Each request method has an abstract method defined by the business side, such as the parameter request method (params) in the GET request (HttpGetRequest). Furthermore, it should be noted that in this embodiment, other request methods can be extended according to actual application needs, which will not be elaborated here.

[0059] Please combine again Figure 4 In this embodiment of the disclosure, the request body (HttpRequestBody) of the POST request method can be extended to support various network requests with different requirements, such as Form requests, file uploads, progress bar displays, etc., as detailed below:

[0060] 1. The Form request body (HttpRequestFormBody) is obtained by extending the Post request body (HttpRequestBody). It is used to request and send network data of type Key or Value. It also has abstract methods defined by the business side, such as the method to encrypt network data of type Key (encodedKey) and the method to encrypt network data of type Value (encodedValue).

[0061] 2. Extend the POST request body (HttpRequestBody) to obtain the file upload request body (HttpRequestMultipartBody), which is used to request file upload. It also has abstract methods defined by the business side, such as the file upload method (okMultipartBody).

[0062] 3. The progress bar display request body (HttpRequestProgressBody) is obtained by extending the POST request body (HttpRequestBody). It is used to request the display of the progress bar. Its internal request body (httpRequestBody) is actually a delegate that performs layer aggregation to extend the progress bar display functionality. In addition, the progress bar display request body (HttpRequestProgressBody) also has abstract methods defined by the business side, such as the progress listening method (progressListener).

[0063] It is understood that in this embodiment of the disclosure, the custom network requests of different request subject categories and different request methods can all be processed by inheriting the corresponding implementation class in the third-party network library, which will not be elaborated here.

[0064] Furthermore, in this embodiment of the disclosure, the request data structure is used to characterize the data composition structure of a custom network request, which will not be elaborated here.

[0065] In this embodiment of the disclosure, after parsing the custom network request to obtain the request type and request data structure, it can be determined whether the request type belongs to a type supported by the third-party network library. If it is determined that the request type belongs to a type supported by the third-party network library, the standard request structure corresponding to the request type in the third-party network library is further determined. Then, according to the standard request structure, the request data structure is transformed so that it has the same data composition structure as the standard request structure, so as to obtain a standard network request that is available in the third-party network library.

[0066] Based on the above-mentioned functions of the target underlying library, in this embodiment of the disclosure, after parsing the custom network request to obtain its request type and request data structure, if it is determined that the request type belongs to a type supported by the third-party network library, the standard request structure corresponding to the request type in the third-party network library can be determined. Then, based on the standard request structure, the request data structure is transformed to obtain a standard network request usable by the third-party network library. On the one hand, because this process has simple logic and short processing time, it can improve the working efficiency of the client communication network. On the other hand, because the third-party network library supports a wide range of types, custom network requests can also have many extensible types, thereby improving the availability of the client communication network.

[0067] The following will combine Figure 5 The overall flow of a network request processing method applied to the client communication network provided in the embodiments of this disclosure will be described.

[0068] 1. The client communication implementation library initiates a custom network request to the target underlying library. Specifically, the custom network request is an asynchronous request (sendRequest).

[0069] 2. The target underlying library uses a third-party network library to asynchronously execute custom network requests. Specifically, the target underlying library calls the corresponding request processing logic through the third-party network library to send a standard network request to the server corresponding to the custom network request, obtains the standard response data returned by the server based on the standard network request, and returns the standard response data to the target underlying library so that the target underlying library can encapsulate the standard response data into custom response data (Response) corresponding to the custom network request.

[0070] 3. The target underlying library sends the custom response data to the client communication implementation library;

[0071] 4. The client communication implementation library sends custom response data (Response) to the business layer;

[0072] 5. The business layer parses the custom response data (Response) to obtain the data parsing result (HttpResponse);

[0073] 6. The business layer sends the data parsing result (HttpResponse) to the client communication implementation library;

[0074] 7. The client communication implementation library then sends the data parsing result (HttpResponse) to the business layer;

[0075] 8. The business layer performs callback processing on the data parsing result (HttpResponse).

[0076] Furthermore, it should be noted that in this embodiment of the disclosure, when the custom network request is a synchronous request (performRequest), steps 2 to 5 above will process the custom network request synchronously. After obtaining the data parsing result (HttpResponse) through step 5, it can be directly sent to the business layer. Since the custom network request is specifically a synchronous request (performRequest), there is no callback processing process as described in steps 6, 7, and 8 above.

[0077] It is understandable that in the overall process of the above network request processing method, all classes used by the business side are customized in the client communication network, including custom network requests, custom response data, client communication implementation libraries, etc., and will not directly depend on classes in third-party network libraries. The process instructions for network request processing are also encapsulated in the corresponding implementation classes in the target underlying library to complete all operations such as initiation, reception, processing, and distribution, and finally return the encapsulated data parsing results to the business layer, thereby ensuring that the business side is unaware of the third-party network library.

[0078] In some optional implementations, the target underlying library is also used to monitor the processing of standard network requests received from a third-party network library, and after obtaining the monitoring data packets, to send the monitoring data packets to the business layer.

[0079] In other words, in this embodiment of the disclosure, the entire process of standard network request processing can also be monitored based on the monitoring and processing logic (implementation class) stored in the third-party network library. For example, it can monitor whether each sub-process in the request processing process is successfully processed and the processing time of each sub-process.

[0080] The various sub-processes include the Domain Name System (DNS) resolution process, the Connect connection establishment process, the Secure Sockets Layer (SSL) connection establishment process, and the actual request processing process. Additionally, please refer to... Figure 6 After the actual request processing flow includes the completion of the request start, request completion, and request failure processes, the execution results and processing time are carried in the monitoring data packet and uniformly called back to the business layer. Therefore, based on the monitoring data packet, the business layer can determine whether each network request is successful and the time consumption of each sub-process.

[0081] Based on the above functions of the target underlying library, in this embodiment of the disclosure, the target underlying library is also used to monitor the processing of standard network requests received from a third-party network library. After obtaining the monitoring data packet, the monitoring data packet is sent to the business layer to facilitate full-process traceability of the request processing, thereby providing convenience for the maintenance of the client communication network and further reducing the maintenance cost of the client communication network.

[0082] In some alternative implementations, the target underlying library is also used for:

[0083] If the monitoring data packet contains standard anomaly data, extract the standard anomaly data from the monitoring data packet.

[0084] Convert standard exception data into corresponding custom exception data;

[0085] Custom exception data is carried in the monitoring data packet and sent to the business layer.

[0086] In this embodiment of the disclosure, when the monitoring data packet carries standard exception data, the standard exception data can be extracted from the monitoring data packet and then converted into corresponding custom exception data. In a specific example, the standard exception data can be converted into corresponding custom exception data based on the exception correspondence stored in the target underlying library, and the custom exception data is defined based on classes in the Java Development Kit (JDK) development tool.

[0087] Please combine Figure 7 In this embodiment of the disclosure, the following types of custom exception data are predefined:

[0088] ConnectionError: Indicates a connection error, and is a wrapper around java.net.ConnectionException;

[0089] TimeoutError: Indicates a timeout error, which is a wrapper around java.net.SocketTimeoutException;

[0090] ServerError: Indicates that the service returned a failure, for example, errno≠0;

[0091] CertificateError: This indicates a network request error, such as an expired certificate. This type of error will only be thrown when certificate monitoring is enabled.

[0092] UnknownHostError: This indicates a DNS resolution error. This type of error will only be thrown when DNS resolution monitoring is enabled.

[0093] ParseError: Indicates an error occurred in the business logic layer while parsing custom response data.

[0094] ResponseSchemeError: This indicates a response schema validation error. This type of error is only thrown when response schema validation is enabled.

[0095] The exception codes corresponding to the above custom exception data are shown in Table 1:

[0096] Table 1

[0097]

[0098]

[0099] Based on the above functions of the target underlying library, in this embodiment of the disclosure, when the monitoring data packet carries standard abnormal data, the standard abnormal data can be extracted from the monitoring data packet and then converted into corresponding custom abnormal data, without relying on the standard abnormal data defined in the third-party network library, thereby achieving further decoupling between the business party and the third-party network library.

[0100] In some alternative implementations, the client communication implementation library is used for:

[0101] In response to a request-triggered operation, generate a custom network request;

[0102] Based on the underlying library selection instructions, a target underlying library with excellent processing performance for custom network requests is determined from multiple candidate underlying libraries;

[0103] Initiate a custom network request to the target underlying library.

[0104] Please combine Figure 8 In this embodiment of the disclosure, the client communication network may actually include multiple candidate underlying libraries, and each candidate underlying library has a corresponding communication network library.

[0105] In a specific example, the multiple candidate underlying libraries include a first candidate underlying library and a second candidate underlying library. The communication network library corresponding to the first candidate underlying library could be the Okhttp network library, and the communication network library corresponding to the second candidate underlying library could be the Cronet network library.

[0106] Furthermore, in this embodiment of the disclosure, having excellent processing performance for custom network requests can mean having a faster processing speed for custom network requests.

[0107] Based on the above functions of the client communication implementation library, in this embodiment of the disclosure, after the client communication implementation library generates a custom network request in response to the request triggering operation, it can determine the target underlying library with excellent processing performance for the custom network request from multiple candidate underlying libraries according to the underlying library selection instruction, and initiate a custom network request to the target underlying library, thereby improving the working efficiency of the client communication network. Compared with the scheme of randomly selecting the target underlying library from multiple candidate underlying libraries, the network request processing efficiency of the client communication network can be improved by more than 20%.

[0108] In this embodiment of the disclosure, the underlying library selection indicator can be generated by the business layer. Based on this, in some optional implementations, the business layer is further used for:

[0109] When the business layer detects the generation of a custom network request, it retrieves the historical request processing records related to the custom network request.

[0110] Based on historical request processing records, a target underlying library with excellent processing performance for custom network requests is determined from multiple candidate underlying libraries.

[0111] Based on the identification information of the target underlying library, generate an underlying library selection instruction;

[0112] Send the underlying library selection instruction to the client communication implementation library.

[0113] The historical request processing record stores historical processing data of other network requests of the same type as the custom network request. Based on this historical processing data, a target underlying library with excellent processing performance for the custom network request can be determined from multiple candidate underlying libraries. Then, based on the identification information of the target underlying library, an underlying library selection instruction is generated and sent to the client communication implementation library.

[0114] Based on the above-mentioned functions of the business layer, in this embodiment of the disclosure, a target underlying library with excellent processing performance for custom network requests can be determined from multiple candidate underlying libraries according to historical request processing records related to custom network requests. Since the historical request processing records are obtained based on the actual network request processing process within a historical period, determining the target underlying library with excellent processing performance for custom network requests from multiple candidate underlying libraries based on these historical request processing records can improve the reliability of the determined target underlying library, thereby ensuring that the working efficiency of the client communication network can be improved in a truly reliable manner.

[0115] Furthermore, in this embodiment of the disclosure, the multiple candidate underlying libraries may include a target candidate underlying library, and the communication network library corresponding to the target candidate underlying library supports HTTP / 3.

[0116] In a specific example, the target candidate underlying library can be the aforementioned second candidate underlying library, whose corresponding communication network library is the Cronet network library, which supports HTTP / 3.

[0117] Because HTTP / 3 has the characteristics of high speed, high security, and stability in weak network conditions, it can further improve the stability of the client's communication network when the target candidate underlying library can be included among multiple candidate underlying libraries and the communication network library corresponding to the target candidate underlying library supports HTTP / 3.

[0118] Please combine Figure 9 In this embodiment of the disclosure, custom network requests can be subject to custom constraints through preset custom specifications.

[0119] Specifically, the preset custom specification can at least impose custom constraints on the data composition structure of custom network requests of the same request type, so that the same custom network request can be universally applied across multiple candidate underlying libraries. Furthermore, in this embodiment, the preset custom specification can also be used to impose custom constraints on custom response data, custom exception data, etc.

[0120] Because custom network requests are constrained by preset custom specifications, custom network requests of the same request type may be used in multiple candidate underlying libraries (e.g., Figure 9 The first and second candidate underlying libraries can be generalized, which facilitates the addition and modification of candidate underlying libraries, thereby increasing the flexibility of the client communication network.

[0121] In addition, please combine Figure 10 In this embodiment of the disclosure, when the client starts running, it is also necessary to initialize the client communication implementation library, such as configuring the client version number and client channel. Simultaneously, network function configurations for the client communication network are performed, such as enabling monitoring to monitor the processing of network requests. Afterward, the client communication implementation library generates a custom network request based on a preset custom specification and initiates the custom network request to the target underlying library. At the same time, it sends various configuration information to the target underlying library. The target underlying library adjusts the custom network request according to this configuration information and uses a third-party network library to obtain custom response data corresponding to the custom network request. The custom response data is then sent to the business layer, which parses the custom response data to obtain the data parsing result.

[0122] After obtaining the data parsing results, you can continue to initiate the next custom network request.

[0123] The client can be a web browser used for the World Wide Web, an email client for sending and receiving emails, instant messaging client software, etc., and this disclosure does not impose specific limitations on it.

[0124] This disclosure provides a network request processing method, which can be applied to the aforementioned client communication network. The following will be combined with... Figure 11 The flowchart shown illustrates a network request processing method provided by an embodiment of this disclosure. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order.

[0125] Step S1101: The client communication implementation library initiates a custom network request to the target underlying library;

[0126] Step S1102: The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request, and sends the custom response data to the business layer; wherein, the third-party network library is the communication network library corresponding to the target underlying library;

[0127] In step S1103, the business layer parses the custom response data to obtain the data parsing result.

[0128] In some alternative implementations, "obtaining custom response data corresponding to a custom network request using a third-party network library" may include the following steps:

[0129] Transform custom network requests into standard network requests usable by third-party network libraries;

[0130] Send a standard network request to a third-party network library so that the third-party network library can initiate a standard network request to the server and obtain standard response data returned by the server based on the standard network request;

[0131] Encapsulate standard response data into custom response data corresponding to custom network requests.

[0132] In some alternative implementations, "transforming custom network requests to obtain standard network requests available to third-party network libraries" may include the following steps:

[0133] Parse the custom network request to obtain the request type and request data structure;

[0134] If it is determined that the request type belongs to a type supported by the third-party network library, determine the standard request structure corresponding to the request type in the third-party network library;

[0135] Based on the standard request structure, the request data structure is transformed to obtain a standard network request usable by a third-party network library.

[0136] In some alternative implementations, the network request processing method may further include the following steps:

[0137] The target underlying library monitors the processing of standard network requests received from a third-party network library, and after obtaining the monitoring data packets, sends the monitoring data packets to the business layer.

[0138] In some alternative implementations, "sending monitoring data packets to the business layer" may include the following steps:

[0139] If the monitoring data packet contains standard anomaly data, extract the standard anomaly data from the monitoring data packet.

[0140] Convert standard exception data into corresponding custom exception data;

[0141] Custom exception data is carried in the monitoring data packet and sent to the business layer.

[0142] In some alternative implementations, "initiating a custom network request to the target underlying library" may include the following steps:

[0143] In response to a request-triggered operation, generate a custom network request;

[0144] Based on the underlying library selection instructions, a target underlying library with excellent processing performance for custom network requests is determined from multiple candidate underlying libraries;

[0145] Initiate a custom network request to the target underlying library.

[0146] In some alternative implementations, the network request processing method may further include the following steps:

[0147] When the business layer detects the generation of a custom network request, it retrieves the historical request processing records related to the custom network request.

[0148] Based on historical request processing records, the business layer determines the target underlying library with excellent processing performance for custom network requests from multiple candidate underlying libraries;

[0149] The business layer generates an underlying library selection instruction based on the identification information of the target underlying library;

[0150] The business layer sends the underlying library selection instruction to the client communication implementation library.

[0151] In some optional implementations, the multiple candidate underlying libraries include the target candidate underlying library, and the communication network library corresponding to the target candidate underlying library supports the third generation Hypertext Transfer Protocol.

[0152] In some alternative implementations, custom network requests are subject to custom constraints through preset custom specifications.

[0153] Furthermore, the specific implementation of each step in this embodiment can be found in the preceding client communication network embodiment, and will not be repeated here.

[0154] The network request processing method provided in this disclosure can initiate a custom network request to a target underlying library through a client communication implementation library. The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request and sends the custom response data to the business layer. The third-party network library is a communication network library corresponding to the target underlying library. The business layer parses the custom response data to obtain the data parsing result. In this disclosure, because a target underlying library is added between the client communication implementation library and the business layer and the third-party network library, and the target underlying library can use the third-party network library to obtain the custom response data corresponding to the custom network request, the client communication implementation library and the business layer do not need to pay attention to the implementation classes in the third-party network library, thus achieving decoupling between the business side and the third-party network library. Therefore, even if the third-party network library needs to be replaced with another communication network library, there is no need to perform corresponding iterative processing on the client communication implementation library and the business layer, achieving a seamless process for the business side, thereby reducing the maintenance cost of the client communication network and improving its stability.

[0155] Please see Figure 12 This is a schematic diagram illustrating an application scenario of a network request processing method provided in an embodiment of this disclosure.

[0156] As previously described, the network request processing method provided in this disclosure is applied to a client communication network, which can be mounted on an electronic device. The electronic device is intended to represent various forms of digital computers, such as mainframe computers, desktop computers, laptop computers, or other suitable terminal devices.

[0157] In this embodiment of the disclosure, the electronic device can be used to perform a network request processing method:

[0158] The client communication implementation library initiates a custom network request to the target underlying library;

[0159] The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request, and sends the custom response data to the business layer; the third-party network library is the communication network library corresponding to the target underlying library.

[0160] The business layer parses the custom response data to obtain the data parsing results.

[0161] In some specific implementations, the target underlying library is used for:

[0162] It should be noted that, in this embodiment of the disclosure, the target underlying library's use of a third-party network library to obtain custom response data corresponding to the custom network request may include: converting the custom network request to obtain a standard network request usable by the third-party network library; sending the standard network request to the third-party network library to initiate a standard network request to the server through the third-party network library, and obtaining standard response data returned by the server based on the standard network request; and encapsulating the standard response data into custom response data corresponding to the custom network request.

[0163] Furthermore, it should be noted that in the embodiments disclosed herein, Figure 12 The schematic diagrams shown are for illustrative purposes only and are not restrictive. Those skilled in the art can use them as a basis for their own interpretation. Figure 12 The examples may be modified in various obvious ways and / or substitutions, and the resulting technical solutions still fall within the scope of the disclosure of the embodiments of this disclosure.

[0164] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0165] According to embodiments of this disclosure, this disclosure also provides an electronic device, a storage medium, and a computer program product.

[0166] Figure 13 A schematic block diagram of an example electronic device 1300 that can be used to implement embodiments of the present disclosure is shown.

[0167] As previously described, in embodiments of this disclosure, the electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital processors, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0168] like Figure 13As shown, the electronic device 1300 includes a computing unit 1301, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 1302 or a computer program loaded from a storage unit 1308 into a random access memory (RAM) 1303. The RAM 1303 may also store various programs and data required for the operation of the electronic device 1300. The computing unit 1301, ROM 1302, and RAM 1303 are interconnected via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0169] Multiple components in electronic device 1300 are connected to I / O interface 1305, including: input unit 1306, such as keyboard, mouse, etc.; output unit 1307, such as various types of displays, speakers, etc.; storage unit 1308, such as disk, optical disk, etc.; and communication unit 1309, such as network card, modem, wireless transceiver, etc. Communication unit 1309 allows electronic device 1300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0170] The computing unit 1301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 1301 performs the methods described above, such as network request processing methods. For example, in some alternative embodiments, the network request processing methods may be implemented as computer software programs tangibly contained in a non-transitory computer-readable storage medium, such as storage unit 1308. In some alternative embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1300 via ROM 1302 and / or communication unit 1309. When the computer program is loaded into RAM 1303 and executed by computing unit 1301, one or more steps of the network request processing method described above can be performed. Alternatively, in other embodiments, computing unit 1301 can be configured to perform the network request processing method by any other suitable means (e.g., by means of firmware).

[0171] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0172] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0173] In the context of this disclosure, a non-transitory computer-readable storage medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A non-transitory computer-readable storage medium can be a machine-readable signal medium or a machine-readable storage medium. A non-transitory computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of non-transitory computer-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM) or flash memory, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a cathode ray tube (CRT) monitor or a liquid crystal display (LCD); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices may also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0175] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected via digital data communication (e.g., a communication network) of any form or medium. Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0176] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0177] This disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the aforementioned network request processing method.

[0178] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned network request processing method.

[0179] The electronic device, medium, and computer program product provided in this disclosure can initiate a custom network request to a target underlying library through a client communication implementation library. The target underlying library uses a third-party network library to obtain custom response data corresponding to the custom network request and sends the custom response data to the business layer. The third-party network library is a communication network library corresponding to the target underlying library. The business layer parses the custom response data to obtain the data parsing result. In this disclosure, because a target underlying library is added between the client communication implementation library and the business layer and the third-party network library, and the target underlying library can use the third-party network library to obtain the custom response data corresponding to the custom network request, the client communication implementation library and the business layer do not need to pay attention to the implementation classes in the third-party network library, thus achieving decoupling between the business side and the third-party network library. Therefore, even when it is necessary to replace the third-party network library with another communication network library, there is no need to perform corresponding iterative processing on the client communication implementation library and the business layer, achieving a seamless process for the business side, thereby reducing the maintenance cost of the client communication network and improving its stability.

[0180] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure is achieved, and this is not limited herein. Furthermore, in this disclosure, relational terms such as "first," "second," and "third" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, "multiple" in this disclosure can be understood as at least two.

[0181] The foregoing specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A client communication network, comprising: a client communication implementation library configured to initiate a custom network request to a target underlying library; the target underlying library configured to obtain custom response data corresponding to the custom network request by using a third-party network library, and send the custom response data to a business layer, wherein the third-party network library is a communication network library corresponding to the target underlying library; the business layer configured to parse the custom response data to obtain a data parsing result; wherein the target underlying library is configured to: parse the custom network request to obtain a request type and a request data structure of the custom network request, and determine a standard request structure corresponding to the request type in the third-party network library if it is determined that the request type belongs to a supportable type of the third-party network library, and convert the request data structure according to the standard request structure to obtain a standard network request available for the third-party network library; send the standard network request to the third-party network library to initiate the standard network request to a server through the third-party network library to obtain standard response data returned by the server based on the standard network request; encapsulate the standard response data as the custom response data corresponding to the custom network request. 2.The communication network of claim 1, wherein the target underlying library is further configured to monitor a processing process of the standard network request by the third-party network library after receiving the monitoring data packet, and send the monitoring data packet to the business layer.

3. The communication network of claim 2, wherein, The target underlying library is further configured to: extract standard exception data from the monitoring data packet if the monitoring data packet carries the standard exception data; convert the standard exception data into corresponding custom exception data; send the custom exception data to the business layer by carrying the custom exception data in the monitoring data packet.

4. The communication network of claim 1, wherein, The client communication implementation library is configured to: generate the custom network request in response to a request triggering operation; determine the target underlying library having superior processing performance for the custom network request from a plurality of candidate underlying libraries according to an underlying library selection indication; initiate the custom network request to the target underlying library. 5.The communication network of claim 4, wherein the business layer is further configured to: obtain a historical request processing record related to the custom network request if it is detected that the custom network request is generated; determine the target underlying library having superior processing performance for the custom network request from the plurality of candidate underlying libraries according to the historical request processing record; generate the underlying library selection indication based on identification information of the target underlying library; send the underlying library selection indication to the client communication implementation library.

6. The communication network of claim 4, wherein, The plurality of candidate underlying libraries includes a target candidate underlying library, and a communication network library corresponding to the target candidate underlying library supports a third generation hypertext transfer protocol.

7. The communication network of any one of claims 1-6, wherein, The custom network request is custom-constrained by a preset custom specification.

8. A network request processing method applied to the communication network of any one of claims 1-7, the method comprising: the client communication implementation library initiating a custom network request to a target underlying library; the target underlying library obtaining custom response data corresponding to the custom network request by using a third-party network library, and sending the custom response data to a business layer; wherein the third-party network library is a communication network library corresponding to the target underlying library; the business layer analyzing the custom response data to obtain a data analysis result; wherein the obtaining of the custom response data corresponding to the custom network request by using the third-party network library comprises: analyzing the custom network request to obtain a request type and a request data structure of the custom network request; in a case where it is determined that the request type belongs to a supportable type of the third-party network library, determining a standard request structure corresponding to the request type in the third-party network library; and converting the request data structure according to the standard request structure to obtain a standard network request available to the third-party network library; sending the standard network request to the third-party network library to initiate the standard network request to a server through the third-party network library to obtain standard response data returned by the server based on the standard network request; encapsulating the standard response data as the custom response data corresponding to the custom network request.

9. The method of claim 8, further comprising: the target underlying library monitoring a processing process of the standard network request by the third-party network library after receiving the monitoring data packet, and sending the monitoring data packet to the business layer.

10. The method of claim 9, wherein, the sending of the monitoring data packet to the business layer comprises: in a case where the monitoring data packet carries standard exception data, extracting the standard exception data from the monitoring data packet; the conversion of the standard exception data into corresponding custom exception data; carrying the custom exception data in the monitoring data packet to the business layer.

11. The method of claim 8, wherein, the initiating of the custom network request to the target underlying library comprises: generating the custom network request in response to a request triggering operation; determining the target underlying library having excellent processing performance for the custom network request from a plurality of candidate underlying libraries according to an underlying library selection indication; initiating the custom network request to the target underlying library.

12. The method of claim 11, further comprising: the business layer obtaining a historical request processing record related to the custom network request in a case where the business layer listens to generation of the custom network request; the business layer determining the target underlying library having excellent processing performance for the custom network request from the plurality of candidate underlying libraries according to the historical request processing record; the business layer generating the underlying library selection indication based on identification information of the target underlying library; the business layer sending the underlying library selection indication to the client communication implementation library.

13. The method of claim 11, wherein, The target candidate underlying library is included in the plurality of candidate underlying libraries, and a communication network library corresponding to the target candidate underlying library supports a third generation hypertext transfer protocol.

14. The method of any one of claims 8-13, wherein, The custom network request is custom-constrained by a preset custom specification. 15.An electronic device, comprising: at least one processor; a memory in communication with the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 8-14.

16. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method according to any one of claims 8-14. 17.A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 8-14.

Citation Information

Patent Citations

  • Network request method and device based on OKHttp and GSON

    CN105681394A

  • Method and device for monitoring Dio network request

    CN113765740A