Network protocol conversion method, device and system, electronic equipment and storage medium
The network communication protocol is converted through the server access gateway and client SDK module, which solves the problem of redevelopment of switching communication protocols in the existing technology, and realizes efficient and configurable communication between the client and the server.
Patent Information
- Application Number
- CN202311108448.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, switching communication protocols between the client and the server need to be redeveloped, resulting in high maintenance costs and coexisting multiple protocols increases the workload.
The network communication protocol is converted through the server access gateway and client SDK module, without the need to redevelop the client and server, and the configurable and advanced communication capabilities between the client and the server are realized.
Without increasing the maintenance costs of clients and servers, efficient communication protocol conversion between clients and servers is realized, improving communication performance and flexibility.
Smart Images

Figure CN119544816A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a network protocol conversion method, device, system, electronic device and storage medium. Background Art
[0002] In the Internet environment, clients and servers often communicate using Hypertext Transfer Protocol (HTTP), Hypertext Transfer Protocol Secure (HTTPS), long connection protocols (websocket or private protocols), etc.
[0003] At present, the communication protocol cannot be switched between the client and the server at will (for example, switching from HTTP to long connection). Switching the communication protocol requires redeveloping the client and the server, and performing interface joint debugging, which is time-consuming and laborious. At the same time, after the communication protocol is changed between the client and the server, considering that the client cannot be upgraded instantly, in order to be compatible with the old client, the server needs to deploy the new and old versions of the communication protocol interface at the same time, which increases the maintenance cost. In addition, the coexistence of multiple protocols is a large workload. For example, the http interface has a large number of mature tools that can assist in testing, stress testing, joint debugging, and problem analysis. If the business only supports the long connection protocol for communication, then the HTTP tool ecosystem cannot be used. If only HTTP is supported, the performance improvement brought by the long connection and the encryption capability of the private protocol communication are missing. If several protocols are supported, it will be a huge workload for the business. Summary of the invention
[0004] The embodiments of the present application provide a network protocol conversion method, device, system, electronic device and storage medium, which convert the network communication protocol between the client and the server through the server access gateway and the client SDK module, without redeveloping the client and the server, so that the client and the server can have configurable and advanced communication capabilities without increasing the maintenance cost of the client and the server. The above technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a network protocol conversion method, which is applied to a client and includes:
[0006] In response to the target operation, a target call request is initiated;
[0007] Use the SDK module to convert the above target call request into the target protocol format;
[0008] Sending the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted to the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server;
[0009] Based on the server access gateway and the SDK module, the target response result returned by the server based on the target call request is obtained.
[0010] In a possible implementation, the SDK module is used to convert the target call request into a target protocol format, including:
[0011] Determine the corresponding target protocol configuration information based on the target call request;
[0012] The SDK module is used to convert the target call request into a target protocol format based on the target protocol configuration information.
[0013] In a possible implementation, the target protocol configuration information includes a target communication protocol corresponding to the target call request; the target communication protocol includes one of the following communication protocols: Hypertext Transfer Protocol, Hypertext Transfer Protocol Security, Long Connection Protocol, Private Long Connection Binary Protocol.
[0014] In a possible implementation, after sending the converted target call request to the server access gateway, the method further includes:
[0015] If the target call request fails to be sent or the corresponding target response result is not obtained within the preset time after the target call request is sent, the target protocol format is updated to other protocol formats, and the step of converting the target call request into the target protocol format using the SDK module is executed again.
[0016] In a second aspect, an embodiment of the present application provides another network protocol conversion method, which is applied to a server access gateway, and the method includes:
[0017] Receive the target call request initiated by the client based on the client SDK module; the target call request is in the target protocol format;
[0018] Convert the above target call request into an internal communication format;
[0019] Sending the target call request converted into the internal communication format to the server, so that the server determines the corresponding target response result based on the target call request;
[0020] Receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
[0021] In a possible implementation, after the client SDK module receives the target call request initiated by the client and before converting the target call request into an internal communication format, the method further includes:
[0022] Determine the target protocol characteristics corresponding to the target call request according to the network handshake characteristics;
[0023] The above converts the above target call request into an internal communication format, including:
[0024] The target call request is converted into an internal communication format based on the target protocol characteristics.
[0025] In a possible implementation, after the client SDK module receives the target call request initiated by the client and before converting the target call request into an internal communication format, the method further includes:
[0026] Authenticate the target call request based on the target authentication information corresponding to the target call request to obtain a target authentication result corresponding to the target call request;
[0027] The above converts the above target call request into an internal communication format, including:
[0028] When the target authentication result is that the authentication is passed, the target call request is converted into an internal communication format.
[0029] In a third aspect, an embodiment of the present application provides another network protocol conversion method, which is applied to a server, and includes:
[0030] Receiving a target call request sent by a server access gateway after the target protocol format is converted into an internal communication format; the target call request is initiated by the client, and the SDK module of the client converts the target call request into the target protocol format;
[0031] Determine the corresponding target response result based on the target call request;
[0032] The target response result is sent to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module.
[0033] In a fourth aspect, an embodiment of the present application provides a client, the client comprising:
[0034] An initiating module, used to initiate a target call request in response to a target operation;
[0035] A first protocol conversion module, used to convert the target call request into a target protocol format using the SDK module;
[0036] The first sending module is used to send the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted to the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server;
[0037] The first acquisition module is used to acquire the target response result returned by the server based on the target call request based on the server access gateway and the SDK module.
[0038] In a possible implementation, the first protocol conversion module includes:
[0039] A first determining unit, configured to determine corresponding target protocol configuration information based on the target call request;
[0040] The first protocol conversion unit is used to convert the target call request into a target protocol format based on the target protocol configuration information by using the SDK module.
[0041] In a possible implementation, the target protocol configuration information includes a target communication protocol corresponding to the target call request; the target communication protocol includes one of the following communication protocols: Hypertext Transfer Protocol, Hypertext Transfer Protocol Security, Long Connection Protocol, Private Long Connection Binary Protocol.
[0042] In a possible implementation, the client further includes:
[0043] The update module is used to update the above-mentioned target protocol format to other protocol formats when the above-mentioned target call request fails to be sent or the corresponding target response result is not obtained within a preset time after the above-mentioned target call request is sent, and to perform the above-mentioned step of converting the above-mentioned target call request into the target protocol format using the SDK module again.
[0044] In a fifth aspect, an embodiment of the present application provides a server access gateway, the server access gateway comprising:
[0045] A first receiving module is used to receive a target call request initiated by the client based on the client SDK module; the target call request is in a target protocol format;
[0046] A second protocol conversion module, used for converting the target call request into an internal communication format;
[0047] A second sending module is used to send the target call request converted into the internal communication format to the server, so that the server determines the corresponding target response result based on the target call request;
[0048] The second receiving module is used to receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
[0049] In a possible implementation, the server access gateway further includes:
[0050] A first determination module is used to determine the target protocol characteristics corresponding to the target call request according to the network handshake characteristics;
[0051] The second protocol conversion module is specifically used for:
[0052] The target call request is converted into an internal communication format based on the target protocol characteristics.
[0053] In a possible implementation, the server access gateway further includes:
[0054] An authentication module is used to authenticate the target call request based on the target authentication information corresponding to the target call request, and obtain a target authentication result corresponding to the target call request;
[0055] The second protocol conversion module is specifically used for:
[0056] When the target authentication result is that the authentication is passed, the target call request is converted into an internal communication format.
[0057] In a sixth aspect, an embodiment of the present application provides a server, the server comprising:
[0058] The third receiving module is used to receive the target call request sent by the server access gateway after the target protocol format is converted into the internal communication format; the target call request is initiated by the client, and the SDK module of the client converts the target call request into the target protocol format;
[0059] A second determination module is used to determine a corresponding target response result based on the target call request;
[0060] The third sending module is used to send the above-mentioned target response result to the above-mentioned server access gateway, so that the above-mentioned server access gateway returns the above-mentioned target response result to the above-mentioned client based on the above-mentioned SDK module.
[0061] In the seventh aspect, an embodiment of the present application provides a network protocol conversion system, the above-mentioned network protocol conversion system comprising: a client, a server access gateway and a server; the above-mentioned client is used to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect; the above-mentioned server access gateway is used to execute the method provided by the second aspect of the embodiment of this specification or any possible implementation of the second aspect; the above-mentioned server is used to execute the method provided by the third aspect of the embodiment of this specification.
[0062] In an eighth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
[0063] The processor is connected to the memory;
[0064] The above-mentioned memory is used to store executable program code;
[0065] The above-mentioned processor runs the program corresponding to the above-mentioned executable program code by reading the executable program code stored in the above-mentioned memory, so as to execute the method provided by the first aspect or any possible implementation of the first aspect or the second aspect or any possible implementation of the second aspect or the third aspect of the embodiment of this specification.
[0066] In the ninth aspect, an embodiment of the present specification provides a computer storage medium, wherein the computer storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor and executing the method provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect or the second aspect or any possible implementation of the second aspect or the third aspect.
[0067] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:
[0068] In one or more embodiments of the present application, the client initiates a target call request in response to a target operation; uses the SDK module to convert the target call request into a target protocol format; sends the converted target call request to a server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server; based on the server access gateway and the SDK module, the target response result returned by the server based on the target call request is obtained, so that when the client and the server communicate, the network communication protocol between the client and the server is converted through the server access gateway and the client SDK module. Without redeveloping the client and the server, it is possible to achieve configurable and advanced communication capabilities between the client and the server without increasing the maintenance costs of the client and the server.
[0069] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0071] Figure 1 A schematic diagram of the architecture of a network protocol conversion system provided for an exemplary embodiment of the present application;
[0072] Figure 2 A flowchart of a network protocol conversion method provided by an exemplary embodiment of the present application;
[0073] Figure 3 A flowchart of another network protocol conversion method provided for an exemplary embodiment of the present application;
[0074] Figure 4 A schematic diagram of the structure of a client provided for an exemplary embodiment of the present application;
[0075] Figure 5 A schematic diagram of the structure of a server access gateway provided for an exemplary embodiment of the present application;
[0076] Figure 6 A schematic diagram of the structure of a server provided by an exemplary embodiment of the present application;
[0077] Figure 7 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0079] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0080] Please refer to the following Figure 1 , which is a schematic diagram of the architecture of a network protocol conversion system provided by an exemplary embodiment of this specification. Figure 1 As shown, the network protocol conversion system may include: a client, a server access gateway and a server. Among them:
[0081] The client includes an SDK module, which encapsulates a variety of client communication protocols, is used for data transmission and communication between different software components, and defines the data format, transmission method, error handling and other related details. The client can be, but is not limited to, a terminal corresponding to the user, and can specifically include one or more user terminals. The user version of the software can be installed in the client to implement functions such as user online triggering call requests and obtaining response results corresponding to the call requests.
[0082] Specifically, after the client initiates the corresponding target call request in response to the user's target operation, the SDK module can be used to convert the target call request into the target protocol format, and the converted target call request is sent to the server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into the internal communication format, and sends the target call request converted into the internal communication format to the server. Finally, the client can obtain the corresponding target response result returned by the server based on the target call request based on the server access gateway and the SDK module. Among them, the client can be, but is not limited to, a mobile phone, tablet computer, laptop computer and other devices installed with the business version software.
[0083] The server access gateway can be a gateway device that connects the server to the network edge. After receiving the target call request initiated by the client based on the client SDK module (the target call request is in the target protocol format), the server access gateway will first convert the target call request in the target protocol format into an internal communication format, and then send the target call request converted into the internal communication format to the server, so that the server can determine the corresponding target response result based on the target call request. Finally, the server access gateway can receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
[0084] It can be understood that the above-mentioned server access gateway can be a device integrated in the server, or it can be a device independent of the server, and the embodiments of the present application are not limited to this.
[0085] The server can be a server that can provide a variety of data call services. After receiving the target call request sent by the server access gateway after the target protocol format is converted into the internal communication format, the server can determine the corresponding target response result based on the target call request, and send the target response result to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module. Among them, the server can be but not limited to a hardware server, a virtual server, a cloud server, etc.
[0086] Understandably, Figure 1 The number of clients, server access gateways, and servers in the network protocol conversion system shown is only an example. In a specific implementation, the network protocol conversion system may include any number of clients, server access gateways, and servers. This specification embodiment does not specifically limit this. For example, but not limited to, the client may be a client cluster consisting of multiple clients, the server access gateway may be a server access gateway cluster consisting of multiple server access gateways, and the server may be a server cluster consisting of multiple servers.
[0087] Please refer to the following Figure 2 , which exemplarily shows a flow chart of a network protocol conversion method provided by an embodiment of the present application. Figure 2 As shown, the network protocol conversion method includes the following steps:
[0088] S201, the client initiates a target call request in response to a target operation.
[0089] Specifically, when a user wants to call a server-side interface to register an account or query information, etc., the target operation can be entered on the client side to trigger the client to initiate a corresponding target call request. The target call request can be a request to call a server-side interface to register a user or query or other function calls, which is not limited to this embodiment of the present application. The target call request may not be limited to carrying request parameters entered by the user, such as but not limited to the mobile phone number to be registered, the information identifier to be queried, etc.
[0090] S202, the client uses the SDK module to convert the target call request into a target protocol format.
[0091] Specifically, after the client initiates a target call request, its SDK module can first determine the corresponding target protocol configuration information based on the target call request, such as but not limited to automatically determining the corresponding target protocol configuration information according to a preset configuration relationship based on the target request type corresponding to the target call request, or directly receiving the target protocol configuration information configured by the development end for the above target call request, etc., and then use the SDK module to convert the target call request into a target protocol format based on the target protocol configuration information. Therefore, no matter what target communication protocol is configured for the target call request, there is no need to redevelop the client, and the client does not need to directly connect to the server's interface. The conversion of various network communication protocols can be achieved through the SDK module, thereby further improving the communication capabilities between the client and the server without increasing the client development and maintenance costs. The above-mentioned preset configuration relationship includes the correspondence between various request types and various protocol configuration information. For example, but not limited to, when the target call request is a call request in the development stage (target request type), the corresponding target protocol configuration information may include HTTP, thereby facilitating verification and testing in the development stage; when the target call request is a call request in the online stage (target request type), the corresponding target protocol configuration information may include an encrypted long connection protocol, thereby improving the communication performance and security between the client and the server in the online stage.
[0092] Furthermore, the target protocol configuration information includes a target communication protocol corresponding to the target call request. The target communication protocol includes one of the following communication protocols: Hypertext Transfer Protocol, Hypertext Transfer Protocol Secure, Persistent Connection Protocol, Private Persistent Connection Binary Protocol.
[0093] S203, the client sends the converted target call request to the server access gateway.
[0094] Specifically, after using the SDK module to determine the target communication protocol corresponding to the target call request and converting the target call request into the target protocol format corresponding to the above-mentioned target communication protocol, the converted target call request can be sent to the server access gateway, so as to subsequently realize low-cost and high-performance communication between the client and the server through the SDK module and the server access gateway.
[0095] S204, the server access gateway converts the target call request converted into the target protocol format into an internal communication format.
[0096] Specifically, after the server access gateway receives a target call request in the target protocol format from the client SDK module, it can, but is not limited to, convert the target call request in the target protocol format into an internal communication format according to a pre-stored conversion relationship between various communication protocol formats and internal communication formats, to facilitate the subsequent internal communication between the server access gateway and the server.
[0097] Optionally, the server access gateway does not provide services for each communication protocol corresponding to a port, but only listens to a single port. That is, after the server access gateway receives the target call request in the target protocol format of the client based on the client SDK module, before converting the target call request in the target protocol format into an internal communication format, the server access gateway can also first determine the target protocol characteristics corresponding to the target call request based on the network handshake characteristics, and then convert the content of the parsed target call request into an internal communication format based on the target protocol characteristics. The above-mentioned internal communication format can be, but is not limited to, an internal RPC communication format, etc., which is used to realize communication between the server access gateway and the server. The above-mentioned internal communication format corresponds to an internal communication protocol, which is an internal private protocol of the server and has nothing to do with the client communication protocol.
[0098] In the embodiment of the present application, no matter which communication protocol is selected between the client and the server, there is no need to redeploy the client and the server, nor is there any need to deploy multiple communication protocol ports. The target call request in the target protocol format corresponding to the target communication protocol can be directly converted into an internal communication format that can communicate internally with the server through the server access gateway, thereby realizing the server's single-port multi-protocol communication capability and improving the communication performance between the client and the server.
[0099] Optionally, in order to ensure the security of communication between the client and the server and the security of the server data, after the server access gateway receives the target call request in the target protocol format of the client based on the client SDK module, before converting the target call request in the target protocol format to the internal communication format, it can also authenticate the target call request based on the target authentication information corresponding to the above target call request to obtain the target authentication result corresponding to the target call request. And, in the case where the target authentication result is authentication passed, it means that the client has the authority to communicate with the server, and the target call request in the target protocol format can be converted to the internal communication format. If the target authentication result is authentication failure, it means that the client does not currently have the authority to communicate with the server, and the target authentication result of the above authentication failure can be returned to the client SDK module, so that the user of the client can be informed of the failure of this target call request in a timely manner.
[0100] It can be understood that when the client SDK module uses the long connection protocol to communicate the target call request with the server access gateway, authentication is required during the network handshake; when the client SDK module uses the short connection protocol to communicate the target call request with the server access gateway, it is necessary to carry the client's authentication information in each request, and the above authentication information is passed in when the SDK module is initialized.
[0101] S205, the server access gateway sends the target call request converted into an internal communication format to the server.
[0102] Specifically, after the server access gateway converts the target call request in the target protocol format into the target call request in the internal communication format, it can call the corresponding interface of the server based on the target call request in the internal communication format to obtain the corresponding target response result.
[0103] S206, the server determines the corresponding target response result based on the target call request.
[0104] Specifically, in the embodiment of the present application, the server only needs to support the call request in the internal communication format. After receiving the target call request in the internal communication format, the server can directly call the corresponding functional interface based on the target call request in the internal communication format to make a corresponding response and obtain the corresponding target response result, so that the server does not need to implement the client access of various communication protocols, and can realize the communication between the client and the server with low cost and high performance.
[0105] S207, the server sends the target response result to the server access gateway.
[0106] Specifically, the above target response result is in an internal communication format.
[0107] Exemplarily, when the target call request is a request to call a server interface for user registration, the above target response result may be but is not limited to the account information or registration result of the user registration; when the target call request is a request to call a server interface for query, the above target response result may be but is not limited to the target query result corresponding to the target call request.
[0108] S208, the server access gateway sends the target response result to the client based on the SDK module.
[0109] Specifically, after the server access gateway receives the target response result in the internal communication format, it can, but is not limited to, convert the target response result in the internal communication format into the target protocol format in a manner similar to S204 and then send it to the client's SDK module, so that the client can obtain the target response result returned by the server based on the target call request based on the server access gateway and the SDK module, so that when the client and the server communicate, the network communication protocol between the client and the server is converted through the server access gateway and the client SDK module. There is no need to redevelop the client and the server, and it is possible to achieve configurable advanced communication capabilities between the client and the server without increasing the maintenance costs of the client and the server.
[0110] Next, another network protocol conversion method provided by an exemplary embodiment of the present application is introduced by taking the client executing the network protocol conversion as an example. Figure 3 As shown, the network protocol conversion method includes the following steps:
[0111] S301, in response to a target operation, initiating a target call request.
[0112] Specifically, S301 is consistent with S201 and will not be described in detail here.
[0113] S302, using the SDK module to convert the target call request into a target protocol format.
[0114] Specifically, S302 is consistent with S202 and will not be repeated here.
[0115] S303, sending the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server.
[0116] Specifically, S303 is consistent with S203 and will not be described in detail here.
[0117] S304, determining whether the target call request fails to be sent or whether the corresponding target response result is not obtained within a preset time after the target call request is sent.
[0118] Specifically, after the client SDK module sends the converted target call request to the server access gateway, it can first determine whether the communication between the current client and the server is successfully connected by judging whether the target call request fails to be sent or whether the corresponding target response result is not obtained within a preset time after the target call request is sent. The above preset time can be, but is not limited to, 1 minute, 20 seconds, 3 minutes, etc.
[0119] S305, when the target call request fails to be sent or the corresponding target response result is not obtained within a preset time after the target call request is sent, the target protocol format is updated to another protocol format.
[0120] Specifically, if the target call request fails to be sent or the corresponding target response result is not obtained within the preset time after the target call request is sent, it can be considered that the target communication protocol currently configured for the target call request is not connected. The client SDK module can update the target protocol format to other protocol formats and execute the above S302 again, using the SDK module to convert the target call request into the target protocol format.
[0121] In an embodiment of the present application, when the target communication protocol between the client SDK module and the server access gateway cannot achieve normal connection, the client SDK module will switch to other channels (other communication protocols) for retry to improve the communication success rate between the client and the server.
[0122] S306, when the target call request is sent successfully, obtaining the target response result returned by the server based on the target call request based on the server access gateway and SDK module.
[0123] Specifically, when the target call request is sent successfully, it means that the client SDK module has successfully established a connection with the server access gateway through the target communication protocol. The client can then obtain the target response result returned by the server based on the target call request based on the server access gateway and SDK module.
[0124] Please refer to the following Figure 4 , which is a schematic diagram of the structure of a client provided by an exemplary embodiment of the present application. Figure 4 As shown, the client 400 includes:
[0125] The initiating module 410 is used to initiate a target call request in response to a target operation;
[0126] A first protocol conversion module 420, configured to convert the target call request into a target protocol format using the SDK module;
[0127] The first sending module 430 is used to send the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted to the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server;
[0128] The first acquisition module 440 is used to acquire the target response result returned by the server based on the target call request based on the server access gateway and the SDK module.
[0129] In a possible implementation, the first protocol conversion module 420 includes:
[0130] A first determining unit, configured to determine corresponding target protocol configuration information based on the target call request;
[0131] The first protocol conversion unit is used to convert the target call request into a target protocol format based on the target protocol configuration information by using the SDK module.
[0132] In a possible implementation, the target protocol configuration information includes a target communication protocol corresponding to the target call request; the target communication protocol includes one of the following communication protocols: Hypertext Transfer Protocol, Hypertext Transfer Protocol Security, Long Connection Protocol, Private Long Connection Binary Protocol.
[0133] In a possible implementation, the client 400 further includes:
[0134] The update module is used to update the above-mentioned target protocol format to other protocol formats when the above-mentioned target call request fails to be sent or the corresponding target response result is not obtained within a preset time after the above-mentioned target call request is sent, and to perform the above-mentioned step of converting the above-mentioned target call request into the target protocol format using the SDK module again.
[0135] The division of the modules in the above-mentioned client is only for illustration. In other embodiments, the client can be divided into different modules as needed to complete all or part of the functions of the above-mentioned client. The implementation of each module in the client provided in the embodiments of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the network protocol conversion method described in the embodiments of this specification are implemented.
[0136] Please refer to the following Figure 5 , which is a schematic diagram of a server access gateway structure provided by an exemplary embodiment of the present application. Figure 5 As shown, the server access gateway 500 includes:
[0137] The first receiving module 510 is used to receive the target call request initiated by the client based on the client SDK module; the target call request is in the target protocol format;
[0138] A second protocol conversion module 520, used to convert the target call request into an internal communication format;
[0139] The second sending module 530 is used to send the target call request converted into the internal communication format to the server, so that the server determines the corresponding target response result based on the target call request;
[0140] The second receiving module 540 is used to receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
[0141] In a possible implementation, the server access gateway 500 further includes:
[0142] A first determination module is used to determine the target protocol characteristics corresponding to the target call request according to the network handshake characteristics;
[0143] The second protocol conversion module 520 is specifically used for:
[0144] The target call request is converted into an internal communication format based on the target protocol characteristics.
[0145] In a possible implementation, the server access gateway 500 further includes:
[0146] An authentication module is used to authenticate the target call request based on the target authentication information corresponding to the target call request, and obtain a target authentication result corresponding to the target call request;
[0147] The second protocol conversion module 520 is specifically used for:
[0148] When the target authentication result is that the authentication is passed, the target call request is converted into an internal communication format.
[0149] The division of the modules in the above-mentioned server access gateway is only for illustration. In other embodiments, the server access gateway can be divided into different modules as needed to complete all or part of the functions of the above-mentioned server access gateway. The implementation of each module in the server access gateway provided in the embodiments of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the network protocol conversion method described in the embodiments of this specification are implemented.
[0150] Please refer to the following Figure 6 , which is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. Figure 6 As shown, the server 600 includes:
[0151] The third receiving module 610 is used to receive the target call request sent by the server access gateway after the target protocol format is converted into the internal communication format; the target call request is initiated by the client, and the SDK module of the client converts the target call request into the target protocol format;
[0152] A second determination module 620 is used to determine a corresponding target response result based on the target call request;
[0153] The third sending module 630 is used to send the target response result to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module.
[0154] The division of each module in the above-mentioned server is only for illustration. In other embodiments, the server can be divided into different modules as needed to complete all or part of the functions of the above-mentioned server. The implementation of each module in the server provided in the embodiment of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the network protocol conversion method described in the embodiment of this specification are implemented.
[0155] See next Figure 7 , which is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Figure 7 As shown, the electronic device 700 may include: at least one processor 710 , at least one communication bus 720 , a user interface 730 , at least one network interface 740 , and a memory 750 .
[0156] The communication bus 720 may be used to realize the connection and communication among the above-mentioned components.
[0157] The user interface 730 may include a display screen (Display) and a camera (Camera), and the optional user interface 730 may also include a standard wired interface and a wireless interface.
[0158] The network interface 740 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, and the like.
[0159] Among them, the processor 710 may include one or more processing cores. The processor 710 uses various interfaces and lines to connect various parts within the entire electronic device 700, and executes various functions and processes data of the routing electronic device 700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 750, and calling data stored in the memory 750. Optionally, the processor 710 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 710 can integrate one or a combination of a processor (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 710, and it can be implemented separately through a chip.
[0160] The memory 750 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 750 includes a non-transitory computer-readable medium. The memory 750 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 750 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a receiving function, a sending function, a protocol conversion function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 750 may optionally be at least one storage device located away from the aforementioned processor 710. As Figure 7 As shown, the memory 750 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0161] In some possible embodiments, the electronic device 700 may be the aforementioned Figure 4 In the client shown, the processor 710 can be used to call the program instructions stored in the memory 750 and specifically perform the following operations:
[0162] In response to the target operation, a target call request is initiated.
[0163] The SDK module is used to convert the above target call request into the target protocol format.
[0164] The converted target call request is sent to the server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server.
[0165] Based on the server access gateway and the SDK module, the target response result returned by the server based on the target call request is obtained.
[0166] In some possible embodiments, when the processor 710 converts the target call request into a target protocol format using the SDK module, it is specifically used to execute:
[0167] The corresponding target protocol configuration information is determined based on the target call request.
[0168] The SDK module is used to convert the target call request into a target protocol format based on the target protocol configuration information.
[0169] In some possible embodiments, the target protocol configuration information includes a target communication protocol corresponding to the target call request; the target communication protocol includes one of the following communication protocols: Hypertext Transfer Protocol, Hypertext Transfer Protocol Secure, Long Connection Protocol, Private Long Connection Binary Protocol.
[0170] In some possible embodiments, after executing sending the converted target call request to the server access gateway, the processor 710 is further configured to execute:
[0171] If the target call request fails to be sent or the corresponding target response result is not obtained within the preset time after the target call request is sent, the target protocol format is updated to other protocol formats, and the step of converting the target call request into the target protocol format using the SDK module is executed again.
[0172] In some possible embodiments, the electronic device 700 may be the aforementioned Figure 5 In the server access gateway shown, the processor 710 can be used to call the program instructions stored in the memory 750 and specifically perform the following operations:
[0173] The target call request initiated by the above client is received based on the client SDK module; the above target call request is in the target protocol format.
[0174] Convert the above target call request into internal communication format.
[0175] The target call request converted into the internal communication format is sent to the server, so that the server determines the corresponding target response result based on the target call request.
[0176] Receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
[0177] In some possible embodiments, after the processor 710 receives the target call request initiated by the client based on the client SDK module and before converting the target call request into the internal communication format, it is further configured to execute:
[0178] The target protocol characteristics corresponding to the target call request are determined according to the network handshake characteristics.
[0179] When the processor 710 converts the target call request into an internal communication format, it is specifically used to execute:
[0180] The target call request is converted into an internal communication format based on the target protocol characteristics.
[0181] In some possible embodiments, after the processor 710 receives the target call request initiated by the client based on the client SDK module and before converting the target call request into the internal communication format, it is further configured to execute:
[0182] The target call request is authenticated based on the target authentication information corresponding to the target call request to obtain a target authentication result corresponding to the target call request.
[0183] When the processor 710 converts the target call request into the internal communication format, it is specifically used to execute: when the target authentication result is that the authentication is passed, convert the target call request into the internal communication format.
[0184] In some possible embodiments, the electronic device 700 may be the aforementioned Figure 6 In the server shown, the processor 710 may be used to call the program instructions stored in the memory 750 and specifically perform the following operations:
[0185] Receive a target call request sent by a server access gateway after converting the target protocol format into an internal communication format; the target call request is initiated by the client, and the SDK module of the client converts the target call request into the target protocol format.
[0186] Determine the corresponding target response result based on the above target call request.
[0187] The target response result is sent to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module.
[0188] The embodiment of the present application also provides a computer storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in any of the above methods. If the components of the above network protocol conversion device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above storage medium.
[0189] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The above computer program product includes one or more computer instructions. When the above computer program instructions are loaded and executed on a computer, the above process or function according to the embodiment of the present application is generated in whole or in part. The above computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above computer instructions can be stored in a computer-readable storage medium or transmitted by the above computer-readable storage medium. The above computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The above computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The above available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0190] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.
[0191] The above-mentioned embodiments are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Without departing from the design spirit of the present application, various modifications and improvements made to the technical solutions of the present application by ordinary technicians in this field should fall within the protection scope determined by the claims of the present application.
Claims
1. A network protocol conversion method, characterized in that: The method is applied to a client, and the method comprises: In response to the target operation, a target call request is initiated; The target call request is converted into a target protocol format using an SDK module; Sending the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server; Based on the server access gateway and the SDK module, a target response result returned by the server based on the target call request is obtained.
2. The method according to claim 1, characterized in that The using the SDK module to convert the target call request into a target protocol format includes: Determine corresponding target protocol configuration information based on the target call request; The target call request is converted into a target protocol format by using an SDK module based on the target protocol configuration information.
3. A network protocol conversion method, characterized in that: The method is applied to a server access gateway, and the method comprises: Receive a target call request initiated by the client based on the client SDK module; the target call request is in a target protocol format; Converting the target call request into an internal communication format; Sending the target call request converted into the internal communication format to the server, so that the server determines the corresponding target response result based on the target call request; The target response result returned by the server is received, and the target response result is sent to the client based on the SDK module.
4. A network protocol conversion method, characterized in that: The method is applied to the server, and the method includes: Receiving a target call request sent by a server access gateway after the target protocol format is converted into an internal communication format; the target call request is initiated by the client and converted into the target protocol format by the SDK module of the client; Determine a corresponding target response result based on the target call request; The target response result is sent to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module.
5. A client, characterized in that: The client comprises: An initiating module, used to initiate a target call request in response to a target operation; A first protocol conversion module, used for converting the target call request into a target protocol format using the SDK module; A first sending module is used to send the converted target call request to the server access gateway, so that the server access gateway converts the target call request converted into the target protocol format into an internal communication format, and sends the target call request converted into the internal communication format to the server; The first acquisition module is used to acquire a target response result returned by the server based on the target call request based on the server access gateway and the SDK module.
6. A server access gateway, characterized in that: The server access gateway includes: A first receiving module, configured to receive a target call request initiated by the client based on a client SDK module; the target call request is in a target protocol format; A second protocol conversion module, used for converting the target call request into an internal communication format; A second sending module, used for sending the target call request converted into the internal communication format to the server, so that the server determines the corresponding target response result based on the target call request; The second receiving module is used to receive the target response result returned by the server, and send the target response result to the client based on the SDK module.
7. A server, characterized in that: The server includes: The third receiving module is used to receive the target call request sent by the server access gateway after the target protocol format is converted into the internal communication format; the target call request is initiated by the client, and the SDK module of the client converts the target call request into the target protocol format; A second determination module, configured to determine a corresponding target response result based on the target call request; The third sending module is used to send the target response result to the server access gateway, so that the server access gateway returns the target response result to the client based on the SDK module.
8. A network protocol conversion system, characterized in that: include: The client and the server access the gateway and the server; wherein the client is used to perform the method steps as described in any one of claims 1-2; The server access gateway is used to execute the method steps as claimed in claim 3; the server is used to execute the method steps as claimed in claim 4.
9. An electronic device, characterized in that: include: processor and memory; wherein, The processor is connected to the memory; the memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method steps according to any one of claims 1 to 4.
10. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 4.