CN111934840A - Communication method of client and server, gateway, electronic equipment and storage medium - Google Patents

Communication method of client and server, gateway, electronic equipment and storage medium Download PDF

Info

Publication number
CN111934840A
CN111934840A CN202010601782.XA CN202010601782A CN111934840A CN 111934840 A CN111934840 A CN 111934840A CN 202010601782 A CN202010601782 A CN 202010601782A CN 111934840 A CN111934840 A CN 111934840A
Authority
CN
China
Prior art keywords
client
gateway
full
server
duplex communication
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010601782.XA
Other languages
Chinese (zh)
Inventor
郑伟强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010601782.XA priority Critical patent/CN111934840A/en
Publication of CN111934840A publication Critical patent/CN111934840A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L5/00Arrangements affording multiple use of the transmission path
    • H04L5/14Two-way operation using the same type of signal, i.e. duplex
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion

Abstract

The application discloses a communication method of a client and a server, a gateway, electronic equipment and a storage medium, and relates to the technical field of cloud computing and communication. The specific implementation scheme is as follows: and carrying out format conversion on the received message sent by the server to obtain a message in a full-duplex communication protocol format, establishing full-duplex communication connection between the target client and the gateway, and then sending the message in the full-duplex communication protocol format to the target client according to the identification of the target client. Therefore, the received message of the server is converted into the message in the full-duplex communication protocol format according to the gateway, so that the situation that the full-duplex communication connection is not established between the gateway and the server can be known, the server does not need to pay more resource overhead for maintaining the full-duplex communication connection, a large amount of server resources can be saved under the condition that the communication between the server and the client is not frequent, and the performance of the gateway is improved.

Description

Communication method of client and server, gateway, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to the field of cloud computing and communications technologies, and in particular, to a communication method, a gateway, an electronic device, and a storage medium for a client and a server.
Background
At present, under the trend of the vigorous development of the mobile internet, high concurrency and real-time response of a user are problems often faced by Web (World wide Web) applications, such as real-time information of financial securities, geographic position acquisition in Web navigation applications, real-time message pushing of social networks, subscription of news, weather reminding and the like, and a server is required to actively push messages to a client.
In the related art, a server pushes a message to a client based on an API (Application Programming Interface) gateway, where a full-duplex communication connection is established between the client and the API gateway, and a full-duplex communication connection is established between the API gateway and a server, and the server sends the message to the API gateway, and then the API gateway sends the message to the client. However, in the above method, full duplex communication connections need to be established between the API gateway and the client, and between the API gateway and the server, and when the frequency of pushing messages by the server is low, more resources are wasted for maintaining the dual connections, which affects the API gateway performance.
Disclosure of Invention
A communication method between a client and a server, a gateway, an electronic device and a storage medium are provided.
An embodiment of a first aspect of the present application provides a communication method between a client and a server, including: receiving a message sent by a server, wherein the message comprises: an identifier of a target client, wherein a full-duplex communication connection is established between the target client and the gateway; carrying out format conversion on the message to obtain a message in a full duplex communication protocol format; and sending the message in the full-duplex communication protocol format to the target client according to the identification of the target client.
An embodiment of a second aspect of the present application provides a gateway, including: a first receiving module, configured to receive a message sent by a server, where the message includes: an identifier of a target client, wherein a full-duplex communication connection is established between the target client and the gateway; the first conversion module is used for carrying out format conversion on the message to obtain a message in a full duplex communication protocol format; and the first sending module is used for sending the message in the full-duplex communication protocol format to the target client according to the identification of the target client.
An embodiment of a third aspect of the present application provides an electronic device, including: at least one camera module; at least one processor in communication with the at least one camera module; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the client-server communication method as described above.
A fourth aspect of the present application is directed to a non-transitory computer readable storage medium storing computer instructions for causing a computer to execute the communication method between a client and a server as described above.
According to the communication method between the client and the server, the message sent by the server is received, and the message comprises: an identifier of a target client, wherein a full-duplex communication connection is established between the target client and the gateway; carrying out format conversion on the message to obtain a message in a full duplex communication protocol format; and sending the message in the full-duplex communication protocol format to the target client according to the target client identification. The method converts the received message of the server into the message in the full-duplex communication protocol format according to the gateway, can know that the full-duplex communication connection is not established between the gateway and the server, can save a large amount of server resources under the scene that the server and the client communicate infrequently, and simultaneously improves the performance of the gateway.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present application;
FIG. 2 is a diagram illustrating a server sending a message to a client according to an embodiment of the present application;
FIG. 3 is a schematic diagram according to a second embodiment of the present application
Fig. 4 is a schematic diagram of a client establishing a full-duplex communication connection with a gateway according to an embodiment of the present application;
FIG. 5 is a schematic illustration according to a third embodiment of the present application;
FIG. 6 is a diagram illustrating a client sending a message to a server according to an embodiment of the present application;
FIG. 7 is a schematic illustration according to a fourth embodiment of the present application;
fig. 8 is a schematic diagram of a server actively ending communication according to an embodiment of the present application;
FIG. 9 is a schematic illustration according to a fifth embodiment of the present application;
FIG. 10 is a schematic diagram illustrating an active termination of communication by a client according to an embodiment of the present application;
FIG. 11 is a schematic illustration according to a sixth embodiment of the present application;
fig. 12 is a block diagram of an electronic device for implementing a communication method between a client and a server according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
A communication method between a client and a server, a gateway, an electronic device, and a storage medium according to embodiments of the present application are described below with reference to the drawings.
Fig. 1 is a schematic diagram according to a first embodiment of the present application. It should be noted that, the execution subject in the embodiment of the present application is a gateway, for example, an API gateway. For the purpose of timely pushing a message, in the embodiment of the present application, a server may actively push a message to a client, as shown in fig. 1, a specific implementation process of the server actively sending a message to the client is as follows:
step 101, receiving a message sent by a server, wherein the message comprises: an identification of a target client, wherein a full-duplex communication connection is established between the target client and the gateway.
In this embodiment, the gateway is an intermediate device between the client and the server, when the server actively sends a message to the target client, the gateway and the server may be connected through a hypertext transfer protocol, and the server may send a message in a hypertext transfer protocol format to the gateway, so that the gateway may receive the message in the hypertext transfer protocol format sent by the server, where the message may include, but is not limited to, an identifier of the target client. The identification of the target client has uniqueness and can be used for identifying the target client. In addition, the message may be real-time information of financial securities, geographic location acquisition in a Web navigation application, real-time message push of a social network, subscription of news, weather alert, and the like. It should be noted that a full-duplex communication connection is pre-established between the target client and the gateway.
And 102, converting the format of the message to obtain the message in the full-duplex communication protocol format.
It can be understood that, because the full-duplex communication connection is established between the target client and the gateway, the format of the message received by the gateway and sent by the server is not the full-duplex communication protocol format, and in order to send the message to the target client, the gateway can convert the format of the message to obtain the message in the full-duplex communication protocol format.
And 103, sending a message in a full-duplex communication protocol format to the target client according to the identifier of the target client.
Further, the gateway sends the converted message in the full-duplex communication protocol format to the target client according to the identification of the target client.
In order that the above embodiments may be better illustrated, the description will now be made by way of example.
As shown in fig. 2, the gateway may be an API gateway, the service end and the API gateway are connected through an HTTP (Hyper Text Transfer Protocol), the API gateway and the target client are connected through a WebSocket, and the API gateway may convert the received message in the format of the hypertext Transfer Protocol to obtain a message in the format of a full duplex communication Protocol, and send the message in the format of the full duplex communication Protocol to the target client. Therefore, full-duplex communication connection is not established between the gateway and the server side, the server side does not need to pay more resource overhead for maintaining the full-duplex communication connection, a large number of server resources can be saved under the condition that the server side and the client side are infrequently communicated, and meanwhile, the performance of the gateway is improved.
In summary, the gateway performs message format conversion on the received message of the server to obtain a message in a full-duplex communication protocol format, a full-duplex communication connection is established between the target client and the gateway, and the gateway sends the message in the full-duplex communication protocol format to the target client according to the identifier of the target client. According to the method, the gateway converts the received message of the server into the message in the full-duplex communication protocol format, so that the situation that the full-duplex communication connection is not established between the gateway and the server can be known, the server does not need to pay more resource overhead for maintaining the full-duplex communication connection, a large amount of server resources can be saved in the scene that the server and the client communicate infrequently, and meanwhile, the gateway performance is improved.
In order to ensure that the gateway sends the converted full-duplex communication protocol format message to the target client, a full-duplex communication connection between the gateway and the target client may be established first, in this embodiment, as shown in fig. 3, fig. 3 is a schematic diagram according to a second embodiment of the present application. When the server side actively sends a message to the client side, before the gateway receives the message sent by the server side, full-duplex communication connection needs to be established between the gateway and the target client side. The target client can send a full-duplex communication connection establishment request to the gateway, the gateway can determine information to be checked of the client according to a client identifier in the connection request, the gateway sends a check request carrying the information to be checked to the server, the server returns corresponding check response information to the gateway, and the gateway processes the full-duplex communication request according to the check response information. Before step 101 of the embodiment described in fig. 1, the following steps may be included:
step 301, receiving a full duplex communication connection establishment request sent by a client, where the establishment request includes: identification of the client.
In this embodiment of the present application, based on a Transmission Control Protocol (TCP), a target client may periodically send an HTTP request to a server through a gateway, and inquire whether a message needs to be sent by the server, when the message needs to be sent by the server, the server informs the client that the message needs to be sent through the gateway, and the client may send a full-duplex communication connection establishment request to the gateway, where it needs to be noted that the full-duplex communication connection establishment request may include, but is not limited to, an identifier of the client.
Step 302, determining information to be verified of the client according to the identifier of the client, and sending a verification request carrying the information to be verified to the server.
Further, the gateway can determine the information to be verified of the client according to the client identifier in the full-duplex communication connection request, and the gateway can send the verification request carrying the information to be verified to the server in the form of an HTTP request. In order to verify whether the client has the authority to establish full-duplex communication connection with the gateway and ensure the security of the requested resource when the client requests the resource, the information to be verified may include one of the following information: the method comprises authority verification information and resource verification information, wherein the resource verification information can be determined according to resources to be requested in the establishment of the full-duplex communication connection, and the resources to be requested can be webpage data and the like.
Step 303, receiving the check response information returned by the server.
And then, the server responds to the check request sent by the gateway and sends the response information to the gateway, so that the gateway can receive the check response information returned by the server.
In order to improve timeliness of a response of a server to a check request sent by a gateway, in the embodiment of the application, before the gateway receives a full-duplex communication connection establishment request sent by a client, the server can send check configuration information to the gateway, after the gateway receives the check configuration information sent by the server, information to be checked can be configured according to the check configuration information, the check request carrying the information to be checked is sent to the server, and the server responds to the check request sent by the gateway in time. Therefore, the timeliness of the response of the server to the check request sent by the gateway can be improved.
And step 304, processing the full duplex communication connection establishment request according to the verification response information.
Optionally, when the verification response information indicates that the verification passes, the gateway establishes a full-duplex communication protocol connection between the client and the gateway; and when the verification response information indicates that the verification is failed, the gateway refuses to establish the full-duplex communication protocol connection between the client and the gateway.
That is to say, the service end performs a verification response on the verification request sent by the gateway, and sends verification response information to the gateway, where the verification response information may be verification passing information or verification refusing information. When the verification response information is verification passing information, the gateway establishes full duplex communication protocol connection with the client; and when the verification response information is verification rejection information, the gateway rejects to establish full-duplex communication protocol connection with the client.
For example, as shown in fig. 4, the client sends a full duplex communication establishment request to the API gateway, the API gateway sends a verification request to the server in the form of an HTTP request, and the server performs a verification response on the verification request, where a successful registration of the HTTP response indicates that the verification response passes, and a failed registration of the HTTP response indicates that the verification response does not pass. And then, the server side sends the verification response information to the API gateway, when the verification response information is that the verification is passed, the API gateway agrees to establish full-duplex communication connection with the client side, and when the verification response information is that the verification is not passed, the API refuses to establish the full-duplex communication connection with the client side.
In summary, a full duplex communication connection establishment request is sent to a gateway according to a client, the gateway can determine information to be checked of the client according to a client identifier in the connection request, the gateway sends a check request carrying the information to be checked to a server, the server returns corresponding check response information to the gateway, and the gateway processes the full duplex communication request according to the check response information, so that the full duplex communication connection request between the gateway and the client can be established, and when the server sends data to the client, the gateway can be ensured to send a message in a converted full duplex communication protocol format to a target client.
In order to ensure the bidirectional communication between the client and the server, in the embodiment of the present application, the server may send a message to the client through the gateway, and the client may also send a message to the server through the gateway, for example, the client uploads data to the server. As shown in fig. 5, fig. 5 is a schematic diagram according to a third embodiment of the present application. The embodiment described in fig. 1 may include the following steps after step 103:
step 501, receiving a message in a full duplex communication protocol format sent by a target client.
It can be understood that the gateway and the target client are connected through full-duplex communication, and therefore, a message sent to the gateway by the target client is in a full-duplex communication protocol format, so that the gateway can receive the message in the full-duplex communication protocol format sent by the target client.
Step 502, format conversion is performed on the message in the full duplex communication protocol format to obtain a message in the hypertext transfer protocol format.
In the embodiment of the application, the gateway and the server can be connected through a hypertext transfer protocol, and in order to ensure that the server can receive the message sent by the gateway, the gateway can perform format conversion on the message in the full-duplex communication protocol format to obtain the message in the hypertext transfer protocol format.
Step 503, sending the message in the format of hypertext transfer protocol to the server.
Further, the gateway sends the message in the format of the hypertext transfer protocol obtained by format conversion to the server, so that the server receives the message in the format of the hypertext transfer protocol sent by the gateway.
For example, as shown in fig. 6, the client and the API gateway are connected through full duplex communication, the API gateway and the server are connected through a hypertext transfer protocol, the client sends the message to the API gateway, and the API gateway converts the format of the message into a hypertext transfer protocol format and sends the message to the server.
In summary, the gateway performs format conversion on the received full-duplex communication message of the target client to obtain a message in a hypertext transfer protocol format, and sends the message in the hypertext transfer protocol format to the server, so that the client can send the message to the server through the gateway, and bidirectional communication between the client and the server is ensured.
In order to reduce the occupation of related resources and improve the performance of the gateway, as an example, when communication between the server and the client is not required, the server may actively end the communication with the client, in this embodiment of the present application, as shown in fig. 7, fig. 7 is a schematic diagram according to a fourth embodiment of the present application. The server may send a disconnect client connection request to the gateway, which then sends a disconnect request to the target client to disconnect the full-duplex communication connection between the gateway and the target client. The specific implementation process is as follows:
step 701, receiving a client connection disconnection request sent by a server, where the client connection disconnection request includes: an identification of a first target client to be disconnected.
In this embodiment of the application, the server may send a request for disconnecting the client to the gateway in an HTTP request manner, where the request for disconnecting the client sent by the server may include an identifier of a first target client to be disconnected, and the identifier of the first target client to be disconnected may be used to identify the first target client that needs to be disconnected.
Since the number of the full-duplex communication connections between the target client and the gateway may be multiple, in order to accurately disconnect the full-duplex communication connection that needs to be disconnected between the target client and the gateway, the disconnection client connection request may further include a first identifier of the full-duplex communication connection to be disconnected. The first identifier of the full-duplex communication connection to be disconnected is used for identifying the full-duplex communication connection which needs to be disconnected by the first target client.
Step 702, according to the identifier of the first target client, sending a disconnection request to the first target client to disconnect the full-duplex communication connection between the first target client and the gateway.
Then, the gateway may send a disconnection request (e.g., a control frame) to the first target client through the full-duplex communication connection according to the identifier of the first target client, so that the gateway disconnects the full-duplex communication with the first client.
For example, as shown in fig. 8, the server sends a request to disconnect the client connection to the API gateway through an HTTP request, the API gateway sends a request to disconnect the client connection to the client through a full-duplex communication connection, and the full-duplex communication connection is disconnected between the client and the API gateway.
In summary, after receiving the client disconnection request sent by the server, the gateway sends a disconnection request to the first target client according to the identifier of the client disconnection request, and the full-duplex communication connection between the gateway and the first client is disconnected. Therefore, occupation of related resources can be reduced, and performance of the gateway is improved.
As another example, when the client and the server do not need to communicate, the client may actively end the communication with the server, in this embodiment, as shown in fig. 9, fig. 9 is a schematic diagram according to a fifth embodiment of this application. The client can send a request for disconnecting the client connection to the gateway, the gateway disconnects the request with the client according to the request for disconnecting the client connection, and stops sending messages to the disconnected client through the server, and the specific implementation process is as follows:
step 901, receiving a client connection disconnection request sent by a client, where the client connection disconnection request includes: an identification of a second target client to be disconnected.
In an embodiment of the present application, the client may send a connection request (e.g., a control frame) for disconnecting the client to the gateway through the full-duplex communication connection, where the connection request for disconnecting the client may include, but is not limited to, an identification of the second target client to be disconnected. The identification of the second target client to be disconnected may be used to identify the second target client that needs to be disconnected.
And step 902, disconnecting the connection with the second target client according to the client disconnection request.
Then, the gateway can disconnect the full-duplex communication connection with the second target client according to the disconnection client connection request.
Step 903, sending notification information carrying the identifier of the second target client to the server to notify the server to stop sending messages to the target client to be disconnected.
Meanwhile, the gateway sends notification information carrying the second target client identifier to the server through the HTTP request, informs the server that the second target client is about to be disconnected, and stops sending messages to the second target client.
For example, as shown in fig. 10, the client sends a disconnection request to the API gateway through full-duplex communication connection, and the API gateway sends a client disconnection notification to the server through an HTTP request, so as to notify the server that the client is about to disconnect, and stop sending messages to the client, and at the same time, the full-duplex communication connection between the API gateway and the client is disconnected.
In summary, the client sends a request for disconnecting the client connection to the gateway, the gateway disconnects the request with the client according to the request for disconnecting the client connection, and stops sending the message to the disconnected client through the server, so that occupation of related resources can be reduced, and performance of the gateway can be improved.
According to the communication method between the client and the server, the message sent by the server is received, and the message comprises the following steps: identification of a target client, wherein full-duplex communication connection is established between the target client and a gateway; carrying out format conversion on the message to obtain a message in a full duplex communication protocol format; and sending a message in a full-duplex communication protocol format to the target client according to the identification of the target client. The method converts the received message of the server into the message in the full-duplex communication protocol format according to the gateway, can know that the full-duplex communication connection is not established between the gateway and the server, can save a large amount of server resources under the scene that the server and the client communicate infrequently, and simultaneously improves the performance of the gateway.
In order to implement the foregoing embodiments, the embodiments of the present application further provide a gateway.
FIG. 11 is a schematic illustration according to a sixth embodiment of the present application. As shown in fig. 11, the gateway 1100 includes: a first receiving module 1110, a first converting module 1120, a first transmitting module 1130.
The first receiving module 1110 is configured to receive a message sent by a server, where the message includes: identification of a target client, wherein full-duplex communication connection is established between the target client and a gateway; a first conversion module 1120, configured to perform format conversion on the message to obtain a message in a full duplex communication protocol format; a first sending module 1130, configured to send a message in a full-duplex communication protocol format to the target client according to the identifier of the target client.
As a possible implementation manner of the embodiment of the present application, the gateway 1100 further includes: the device comprises a second receiving module, a second conversion module and a second sending module.
The second receiving module is used for receiving the message in the full-duplex communication protocol format sent by the target client; the second conversion module is used for carrying out format conversion on the message in the full-duplex communication protocol format to obtain the message in the hypertext transfer protocol format; and the second sending module is used for sending the message in the format of the hypertext transfer protocol to the server.
As a possible implementation manner of the embodiment of the present application, the gateway 1100 further includes: the device comprises a third receiving module, a third sending module, a fourth receiving module and a processing module.
The third receiving module is configured to receive a full-duplex communication connection establishment request sent by a client, where the establishment request includes: an identity of the client; the third sending module is used for determining information to be verified of the client according to the identification of the client and sending a verification request carrying the information to be verified to the server; the fourth receiving module is used for receiving the verification response information returned by the server; and the processing module is used for processing the full duplex communication connection establishment request according to the verification response information.
As a possible implementation manner of the embodiment of the application, the processing module is configured to establish a full-duplex communication protocol connection between the client and the gateway when the verification response information indicates that the verification passes; and when the verification response information indicates that the verification is failed, refusing to establish the full-duplex communication protocol connection between the client and the gateway.
As a possible implementation manner of the embodiment of the present application, the information to be verified includes at least one of the following information: and the resource verification information is determined according to the resource to be requested in the establishment request.
As a possible implementation manner of the embodiment of the present application, the first receiving module 1110 is further configured to receive verification configuration information sent by the server, where the verification configuration information represents information to be verified that needs to be provided by the gateway.
As a possible implementation manner of the embodiment of the present application, the first receiving module 1110 is further configured to receive a client connection disconnection request sent by a server, where the client connection disconnection request includes: an identifier of a first target client to be disconnected; the first sending module 1130 is further configured to send a disconnection request to the first target client according to the identifier of the first target client, so as to disconnect the full-duplex communication connection between the first target client and the gateway.
As a possible implementation manner of the embodiment of the present application, the gateway 1110 further includes: the client-side disconnection module is used for receiving a client-side disconnection request sent by a client side, wherein the client-side disconnection request comprises: an identifier of a second target client to be disconnected; the disconnection module is used for disconnecting the connection with the second target client according to the client connection disconnection request; the first sending module is further configured to send notification information carrying the identifier of the second target client to the server, so as to notify the server to stop sending the message to the target client to be disconnected.
As a possible implementation manner of the embodiment of the present application, the number of full-duplex communication connections between the target client and the gateway is multiple; the client disconnect request further comprises: and the first identifier of the full-duplex communication connection to be disconnected, so that the first target client disconnects the full-duplex communication connection corresponding to the first identifier between the first target client and the gateway.
The gateway of the embodiment of the application receives the message sent by the server, and the message includes: identification of a target client, wherein full-duplex communication connection is established between the target client and a gateway; carrying out format conversion on the message to obtain a message in a full duplex communication protocol format; and sending a message in a full-duplex communication protocol format to the target client according to the identification of the target client. The gateway can convert the received message of the server into the message in the full-duplex communication protocol format, and can know that the full-duplex communication connection is not established between the gateway and the server, so that a large amount of server resources can be saved and the performance of the gateway can be improved under the condition that the server and the client communicate infrequently.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 12 is a block diagram of an electronic device according to a communication method between a client and a server according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 12, the electronic apparatus includes: one or more processors 1201, memory 1202, and interfaces for connecting the various components, including a high speed interface and a low speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 12 illustrates an example of one processor 1201.
Memory 1202 is a non-transitory computer readable storage medium as provided herein. The memory stores instructions executable by at least one processor, so that the at least one processor executes the communication method of the client and the server. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute the communication method of the client and the server provided by the present application.
The memory 1202 is a non-transitory computer readable storage medium, and can be used for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the first receiving module 1110, the first converting module 1120, and the first transmitting module 1130 shown in fig. 11) corresponding to the communication methods of the client and the server in the embodiment of the present application. The processor 1201 executes various functional applications of the server and data processing, i.e., a communication method of the client and the server in the above-described method embodiments, by executing the non-transitory software programs, instructions, and modules stored in the memory 1202.
The memory 1202 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device for communication of the client and the server, and the like. Further, the memory 1202 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 1202 may optionally include memory located remotely from the processor 1201, which may be connected over a network to the client and server communicating electronic devices. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the communication method of the client and the server may further include: an input device 1203 and an output device 1204. The processor 1201, the memory 1202, the input device 1203, and the output device 1204 may be connected by a bus or other means, and the bus connection is exemplified in fig. 12.
The input device 1203 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic equipment in communication with the client and the server, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, and the like. The output devices 1204 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a 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 may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (20)

1. A communication method of a client and a server comprises the following steps:
receiving a message sent by a server, wherein the message comprises: an identifier of a target client, wherein a full-duplex communication connection is established between the target client and the gateway;
carrying out format conversion on the message to obtain a message in a full duplex communication protocol format;
and sending the message in the full-duplex communication protocol format to the target client according to the identification of the target client.
2. The method of claim 1, further comprising:
receiving a message in the full duplex communication protocol format sent by a target client;
carrying out format conversion on the message in the full duplex communication protocol format to obtain a message in a hypertext transfer protocol format;
and sending a message in a hypertext transfer protocol format to the server.
3. The method of claim 1, wherein before receiving the message sent by the server, the method further comprises:
receiving a full-duplex communication connection establishment request sent by a client, wherein the establishment request comprises: an identity of the client;
determining information to be verified of the client according to the identification of the client, and sending a verification request carrying the information to be verified to the server;
receiving verification response information returned by the server;
and processing the full duplex communication connection establishment request according to the verification response information.
4. The method of claim 3, wherein processing the full-duplex communication connection establishment request according to the verification response information comprises:
when the check response information indicates that the check is passed, establishing full-duplex communication protocol connection between the client and the gateway;
and when the verification response information indicates that the verification is failed, refusing to establish full-duplex communication protocol connection between the client and the gateway.
5. The method of claim 3, wherein the information to be verified comprises at least one of: and the resource verification information is determined according to the resource to be requested in the establishment request.
6. The method of claim 3 or 5, wherein before receiving the full-duplex communication connection establishment request sent by the client, further comprising:
and receiving verification configuration information sent by the server, wherein the verification configuration information represents information to be verified, which needs to be provided by the gateway.
7. The method of claim 1, further comprising:
receiving a client connection disconnection request sent by a server, wherein the client connection disconnection request comprises: an identifier of a first target client to be disconnected;
and sending a disconnection request to the first target client according to the identifier of the first target client so as to disconnect the full-duplex communication connection between the first target client and the gateway.
8. The method of claim 1, further comprising:
receiving a client connection disconnection request sent by a client, wherein the client connection disconnection request comprises: an identifier of a second target client to be disconnected;
according to the client disconnection request, disconnecting the second target client;
and sending notification information carrying the identifier of the second target client to the server to notify the server to stop sending messages to the target client to be disconnected.
9. The method of claim 7, wherein the number of full-duplex communication connections between the target client and the gateway is plural;
the client disconnection request further comprises: and the first identifier of the full-duplex communication connection to be disconnected facilitates the disconnection of the full-duplex communication connection corresponding to the first identifier between the first target client and the gateway by the first target client.
10. A gateway, comprising:
a first receiving module, configured to receive a message sent by a server, where the message includes: an identifier of a target client, wherein a full-duplex communication connection is established between the target client and the gateway;
the first conversion module is used for carrying out format conversion on the message to obtain a message in a full duplex communication protocol format;
and the first sending module is used for sending the message in the full-duplex communication protocol format to the target client according to the identification of the target client.
11. The gateway of claim 10, wherein the gateway further comprises:
the second receiving module is used for receiving the message in the full-duplex communication protocol format sent by the target client;
the second conversion module is used for carrying out format conversion on the message in the full-duplex communication protocol format to obtain a message in a hypertext transfer protocol format;
and the second sending module is used for sending the message in the format of the hypertext transfer protocol to the server.
12. The gateway of claim 10, wherein the gateway further comprises:
a third receiving module, configured to receive a full-duplex communication connection establishment request sent by a client, where the establishment request includes: an identity of the client;
the third sending module is used for determining information to be verified of the client according to the identification of the client and sending a verification request carrying the information to be verified to the server;
the fourth receiving module is used for receiving the verification response information returned by the server;
and the processing module is used for processing the full duplex communication connection establishment request according to the verification response information.
13. The gateway of claim 12, wherein the processing module is to,
when the check response information indicates that the check is passed, establishing full-duplex communication protocol connection between the client and the gateway;
and when the verification response information indicates that the verification is failed, refusing to establish full-duplex communication protocol connection between the client and the gateway.
14. The gateway of claim 12, wherein the information to be verified comprises at least one of: and the resource verification information is determined according to the resource to be requested in the establishment request.
15. The gateway of claim 12 or 14,
the first receiving module is further configured to receive verification configuration information sent by the server, where the verification configuration information represents information to be verified that needs to be provided by the gateway.
16. The gateway of claim 10, wherein,
the first receiving module is further configured to receive a client connection disconnection request sent by a server, where the client connection disconnection request includes: an identifier of a first target client to be disconnected;
the first sending module is further configured to send a disconnection request to the first target client according to the identifier of the first target client, so as to disconnect the full-duplex communication connection between the first target client and the gateway.
17. The gateway of claim 10, wherein the gateway further comprises: a disconnection module;
the first receiving module is further configured to receive a client connection disconnection request sent by a client, where the client connection disconnection request includes: an identifier of a second target client to be disconnected;
the disconnection module is used for disconnecting the connection with the second target client according to the client connection disconnection request;
the first sending module is further configured to send notification information carrying the identifier of the second target client to the server, so as to notify the server to stop sending messages to the target client to be disconnected.
18. The gateway of claim 16, wherein the number of full-duplex communication connections between the target client and the gateway is plural;
the client disconnection request further comprises: and the first identifier of the full-duplex communication connection to be disconnected facilitates the disconnection of the full-duplex communication connection corresponding to the first identifier between the first target client and the gateway by the first target client.
19. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-9.
CN202010601782.XA 2020-06-29 2020-06-29 Communication method of client and server, gateway, electronic equipment and storage medium Pending CN111934840A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010601782.XA CN111934840A (en) 2020-06-29 2020-06-29 Communication method of client and server, gateway, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010601782.XA CN111934840A (en) 2020-06-29 2020-06-29 Communication method of client and server, gateway, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111934840A true CN111934840A (en) 2020-11-13

Family

ID=73316278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010601782.XA Pending CN111934840A (en) 2020-06-29 2020-06-29 Communication method of client and server, gateway, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111934840A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615822A (en) * 2020-12-03 2021-04-06 北京皮尔布莱尼软件有限公司 Message processing method and device, computing equipment and readable storage medium
CN113094139A (en) * 2021-04-20 2021-07-09 北京沃东天骏信息技术有限公司 UI style updating method and device
CN113726869A (en) * 2021-08-26 2021-11-30 阿里巴巴(中国)有限公司 Communication method, gateway and electronic equipment
CN114025016A (en) * 2021-10-18 2022-02-08 中国联合网络通信集团有限公司 Data forwarding method and device and storage medium
CN114120642A (en) * 2021-11-23 2022-03-01 深圳大学 Road traffic flow three-dimensional reconstruction method, computer equipment and storage medium
CN114143056A (en) * 2021-11-24 2022-03-04 上海派拉软件股份有限公司 Terminal access method and device, electronic equipment and storage medium
CN114629889A (en) * 2022-03-15 2022-06-14 北京天融信网络安全技术有限公司 Method, device, equipment and medium for establishing remote control link
CN114979288A (en) * 2022-05-17 2022-08-30 中国工商银行股份有限公司 Method, device and system for controlling client, storage medium and electronic equipment
CN115086425A (en) * 2022-08-23 2022-09-20 中航金网(北京)电子商务有限公司 Message transmission method, device, program product, medium and electronic equipment
CN115913809A (en) * 2022-09-26 2023-04-04 重庆长安汽车股份有限公司 Data distribution communication method, system, computer device and storage medium
CN113094139B (en) * 2021-04-20 2024-04-19 北京沃东天骏信息技术有限公司 UI style updating method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546800A (en) * 2012-01-06 2012-07-04 华为技术有限公司 Handshake and communication methods for gateway, gateway and Web communication system
WO2015158064A1 (en) * 2014-04-18 2015-10-22 中兴通讯股份有限公司 Communication protocol conversion method, device and storage media
CN108989356A (en) * 2018-09-10 2018-12-11 四川长虹电器股份有限公司 A kind of method that API gateway realizes protocol conversion
CN109525661A (en) * 2018-11-14 2019-03-26 北京奇艺世纪科技有限公司 Data transmission method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546800A (en) * 2012-01-06 2012-07-04 华为技术有限公司 Handshake and communication methods for gateway, gateway and Web communication system
WO2015158064A1 (en) * 2014-04-18 2015-10-22 中兴通讯股份有限公司 Communication protocol conversion method, device and storage media
CN108989356A (en) * 2018-09-10 2018-12-11 四川长虹电器股份有限公司 A kind of method that API gateway realizes protocol conversion
CN109525661A (en) * 2018-11-14 2019-03-26 北京奇艺世纪科技有限公司 Data transmission method and device

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615822A (en) * 2020-12-03 2021-04-06 北京皮尔布莱尼软件有限公司 Message processing method and device, computing equipment and readable storage medium
CN112615822B (en) * 2020-12-03 2022-06-10 北京皮尔布莱尼软件有限公司 Message processing method and device, computing equipment and readable storage medium
CN113094139A (en) * 2021-04-20 2021-07-09 北京沃东天骏信息技术有限公司 UI style updating method and device
CN113094139B (en) * 2021-04-20 2024-04-19 北京沃东天骏信息技术有限公司 UI style updating method and device
CN113726869A (en) * 2021-08-26 2021-11-30 阿里巴巴(中国)有限公司 Communication method, gateway and electronic equipment
CN114025016A (en) * 2021-10-18 2022-02-08 中国联合网络通信集团有限公司 Data forwarding method and device and storage medium
CN114025016B (en) * 2021-10-18 2024-03-15 中国联合网络通信集团有限公司 Data forwarding method, device and storage medium
CN114120642A (en) * 2021-11-23 2022-03-01 深圳大学 Road traffic flow three-dimensional reconstruction method, computer equipment and storage medium
CN114143056A (en) * 2021-11-24 2022-03-04 上海派拉软件股份有限公司 Terminal access method and device, electronic equipment and storage medium
CN114143056B (en) * 2021-11-24 2024-04-05 上海派拉软件股份有限公司 Terminal access method and device, electronic equipment and storage medium
CN114629889B (en) * 2022-03-15 2024-03-15 北京天融信网络安全技术有限公司 Remote control link establishment method, device, equipment and medium
CN114629889A (en) * 2022-03-15 2022-06-14 北京天融信网络安全技术有限公司 Method, device, equipment and medium for establishing remote control link
CN114979288A (en) * 2022-05-17 2022-08-30 中国工商银行股份有限公司 Method, device and system for controlling client, storage medium and electronic equipment
CN115086425B (en) * 2022-08-23 2022-11-08 中航金网(北京)电子商务有限公司 Message transmission method, device, program product, medium and electronic equipment
CN115086425A (en) * 2022-08-23 2022-09-20 中航金网(北京)电子商务有限公司 Message transmission method, device, program product, medium and electronic equipment
CN115913809A (en) * 2022-09-26 2023-04-04 重庆长安汽车股份有限公司 Data distribution communication method, system, computer device and storage medium

Similar Documents

Publication Publication Date Title
CN111934840A (en) Communication method of client and server, gateway, electronic equipment and storage medium
CN111741026B (en) Cross-chain transaction request processing method, device, equipment and storage medium
CN103404113A (en) Notice pushing method, device and system
CN107528891B (en) Websocket-based automatic clustering method and system
US20130091502A1 (en) System and method of providing virtual machine using device cloud
WO2017174026A1 (en) Client connection method and system
EP3816802A2 (en) Method and device for processing mini program data
EP4247103A1 (en) Method and apparatus for determining satellite backhaul information
CN111866092B (en) Message transmission method and device, electronic equipment and readable storage medium
WO2022170446A1 (en) Method and apparatus for determining satellite link information
CN113162848A (en) Method, device, gateway and medium for realizing block chain gateway
CN112511505A (en) Authentication system, method, device, equipment and medium
CN111770176B (en) Traffic scheduling method and device
KR102565409B1 (en) Method, device, electronic equipment for adjusting the number of instances and readble storage medium
CN113825170A (en) Method and apparatus for determining network channel
CN112532720A (en) Data forwarding method, device, equipment and storage medium
CN113420275B (en) Data connection processing method, related device and computer program product
EP3451717A1 (en) Message pushing system, client equipment and message pushing method thereof
CN112153754B (en) Point-to-point connection method and device, electronic equipment and storage medium
CN112489659B (en) Data processing method, system, server and terminal equipment based on input method
CN110659184B (en) Health state checking method, device and system
CN111510480B (en) Request sending method and device and first server
CN112162868B (en) Data communication method, device and storage medium applied to cluster processing
CN112992141B (en) Communication method and device in voice recognition scene
CN113079188B (en) Client identification processing method, device, terminal, server, system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination