CN110324405B - Message sending method, device, system and computer readable storage medium - Google Patents

Message sending method, device, system and computer readable storage medium Download PDF

Info

Publication number
CN110324405B
CN110324405B CN201910459451.4A CN201910459451A CN110324405B CN 110324405 B CN110324405 B CN 110324405B CN 201910459451 A CN201910459451 A CN 201910459451A CN 110324405 B CN110324405 B CN 110324405B
Authority
CN
China
Prior art keywords
target server
message
server
preset
client
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.)
Active
Application number
CN201910459451.4A
Other languages
Chinese (zh)
Other versions
CN110324405A (en
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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201910459451.4A priority Critical patent/CN110324405B/en
Publication of CN110324405A publication Critical patent/CN110324405A/en
Application granted granted Critical
Publication of CN110324405B publication Critical patent/CN110324405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The invention provides a message sending method, a message sending device, a message sending system and a computer readable storage medium, and belongs to the technical field of networks. The client sends an access request message to the scheduling server, the scheduling server determines the target server after receiving the access request message, generates a response message containing the address of the target server and a preset mark representing the transmission protocol supported by the target server according to the transmission protocol supported by the target server and the address of the target server, and finally sends the response message to the client, and the client sends a message to be processed to the target server according to the address of the target server in the response message and based on the transmission protocol supported by the target server. Therefore, the problem that the message processing fails due to the fact that the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server can be avoided, and the success rate of the message processing is improved.

Description

Message sending method, device, system and computer readable storage medium
Technical Field
The present invention belongs to the field of network technology, and in particular, relates to a message sending method, device, system and computer readable storage medium.
Background
Currently, a client or a server often transmits a message based on a Hypertext transfer protocol (HTTP), and with the continuous development of the network technology field, the HTTP protocol is continuously developed, and a new generation of a high-version HTTP protocol, for example, HTTP2.0, is developed on the basis of a low-version HTTP protocol, for example, HTTP1.1, wherein HTTP2.0 is divided into a plaintext HTTP protocol (HTTP2Over clear, H2C) and a ciphertext HTTP protocol (HTTP2Over TLS).
In the prior art, when a client sends a message to be processed to a server, the client often obtains an address of a target server from a scheduling server, and then sends the message to be processed to the target server based on a default version of an HTTP protocol according to the address of the target server.
However, because each server processes different services, versions of HTTP protocols supported by different servers are different, and a server supporting only a low-version HTTP protocol cannot normally process a message to be processed transmitted based on a high-version HTTP protocol, a failure rate of message transmission is high in a manner in the prior art.
Disclosure of Invention
In view of this, the present invention provides a message sending method, device, system and computer readable storage medium, which solves the problem of high failure rate of message sending to a certain extent.
According to a first aspect of the present invention, a message sending method is provided, which is applied to a system including a client and a scheduling server, and the method may include:
the client sends an access request message to the scheduling server;
after receiving the access request message, the scheduling server selects a target server from the managed alternative servers;
the dispatching server generates a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
the dispatching server sends the response message to the client;
the client receives a response message returned by the scheduling server;
and the client sends a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server represented by the preset mark.
According to a second aspect of the present invention, there is provided a message sending method applied to a scheduling server, where the method may include:
after receiving an access request message sent by a client, selecting a target server from the managed alternative servers;
generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
and sending the response message to the client.
Optionally, the generating a response message according to the transmission protocol supported by the target server and the address of the target server includes:
generating a first initial message containing an address of the target server;
and adding a preset mark at a first preset position of the first initial message to obtain the response message.
Optionally, the first preset position is a header of the initial message;
adding a preset mark at a first preset position of the first initial message to obtain the response message, including:
if the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP), adding a first preset mark at the head of the first initial message; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, adding a second preset mark at the head of the first initial message.
Optionally, the accessing request message is transmitted based on a low version HTTP protocol, and the sending the response message to the client includes:
transmitting the response message to the client based on the low-version HTTP protocol.
According to a third aspect of the present invention, there is provided a message sending method applied to a client, where the method may include:
sending an access request message to a scheduling server;
receiving a response message returned by the scheduling server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
and sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server represented by the preset mark.
Optionally, the preset flag is set at a first preset position of the response message; before sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and indicated by the preset flag, the method further includes:
extracting a field in the first preset position in the response message;
if the field in the first preset position comprises a preset identifier matched with the first preset identifier, determining that the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP); alternatively, the first and second liquid crystal display panels may be,
and if the field in the first preset position comprises a preset identifier matched with a second preset identifier, determining that the transmission protocol supported by the target server is a low-version HTTP protocol.
Optionally, the sending, according to the address of the target server and based on the transmission protocol supported by the target server and indicated by the preset flag, the message to be processed to the target server includes:
if the transmission protocol supported by the target server is a high-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
Optionally, the sending, to the target server, a to-be-processed message whose message format matches the message format of the low-version HTTP protocol based on the address of the target server includes:
generating a second initial message in a message format of the low version HTTP protocol;
adding an upgrading request field in a second preset position of the second initial message, and sending the added second initial message serving as the message to be processed to the target server;
the upgrade request field is used for indicating the target server to switch the supported access protocol to the high-version HTTP when supporting protocol upgrade, and transmitting subsequent messages with the client based on the high-version HTTP.
According to a fourth aspect of the present invention, there is provided a message transmission system, which may include;
a client and a scheduling server;
the client is used for sending an access request message to the scheduling server;
the scheduling server is used for selecting a target server from the managed alternative servers after receiving the access request message;
the dispatching server is used for generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
the scheduling server is used for sending the response message to the client;
the client is used for receiving the response message returned by the scheduling server;
and the client is used for sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server represented by the preset mark.
According to a fifth aspect of the present invention, there is provided a message sending apparatus applied to a scheduling server, the apparatus may include:
the determining module is used for selecting a target server from the managed alternative servers after receiving an access request message sent by the client;
the generating module is used for generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
and the sending module is used for sending the response message to the client.
Optionally, the generating module is specifically configured to:
generating a first initial message containing an address of the target server;
and adding a preset mark at a first preset position of the first initial message to obtain the response message.
Optionally, the first preset position is a header of the initial message;
the generating module is further specifically configured to:
if the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP), adding a first preset mark at the head of the first initial message; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, adding a second preset mark at the head of the first initial message.
Optionally, the access request message is transmitted based on a low-version HTTP protocol, and the sending module is specifically configured to:
transmitting the response message to the client based on the low-version HTTP protocol.
According to a sixth aspect of the present invention, there is provided a message sending apparatus, applied to a client, the apparatus may include:
the first sending module is used for sending an access request message to the scheduling server;
the receiving module is used for receiving a response message returned by the scheduling server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
and the second sending module is used for sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark.
Optionally, the preset flag is set at a first preset position of the response message; the device further comprises;
the extracting module is used for extracting the field in the first preset position in the response message;
the first determining module is used for determining that the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP) if the field in the first preset position comprises a preset identifier matched with the first preset identifier; alternatively, the first and second electrodes may be,
and the second determining module is used for determining that the transmission protocol supported by the target server is a low-version HTTP (hyper text transport protocol) if the field in the first preset position comprises a preset identifier matched with a second preset identifier.
Optionally, the second sending module is specifically configured to:
if the transmission protocol supported by the target server is a high-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
Optionally, the second sending module is further specifically configured to:
generating a second initial message in a message format of the low version HTTP protocol;
adding an upgrading request field in a second preset position of the second initial message, and sending the added second initial message serving as the message to be processed to the target server;
the upgrade request field is used for indicating the target server to switch the supported access protocol to the high-version HTTP when supporting protocol upgrade, and transmitting subsequent messages with the client based on the high-version HTTP.
In a seventh aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the steps of the message sending method according to the first aspect.
Aiming at the prior art, the invention has the following advantages:
the client may send an access request message to the scheduling server, after receiving the access request message, the scheduling server may determine a target server according to a processing parameter of each candidate server managed by the scheduling server, generate a response message according to a transmission protocol supported by the target server and an address of the target server, where the response message includes the address of the target server and a preset flag indicating the transmission protocol supported by the target server, and then the scheduling server may send the response message to the client, which may receive the response message returned by the scheduling server, and send a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server. In the embodiment of the invention, the dispatching server adds the transmission protocol supported by the target server in the response message, and accordingly, the client sends the message to be processed to the target server based on the transmission protocol supported by the target server, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when the message is sent and the transmission protocol supported by the target server can be avoided, and the success rate of message processing is further improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1-1 is a schematic view of an application scenario provided in an embodiment of the present invention;
fig. 1-2 is a flowchart illustrating steps of a message sending method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention;
fig. 4-1 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention;
fig. 4-2 is a process diagram of a message sending method according to an embodiment of the present invention;
fig. 4-3 is a process diagram of a message sending method according to an embodiment of the present invention;
fig. 4-4 is a process diagram of another message sending method provided by the embodiment of the present invention;
fig. 5 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention;
fig. 6 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention;
fig. 7 is a block diagram of a messaging system according to an embodiment of the present invention;
fig. 8 is a block diagram of a message sending apparatus according to an embodiment of the present invention;
fig. 9-1 is a block diagram of another message sending apparatus provided in an embodiment of the present invention;
fig. 9-2 is a block diagram of another message sending apparatus according to an embodiment of the present invention;
FIG. 10 is a block diagram of another messaging system provided by embodiments of the present invention;
fig. 11 is a block diagram of another message sending apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1-1 is a schematic view of an application scenario provided by an embodiment of the present invention, as shown in fig. 1-1, the application scenario may include an electronic device 110 with a client, a scheduling server 120, and an alternative server 130 managed by the scheduling server 120 (fig. 1 illustrates that the application scenario includes two alternative servers 130), further, the scheduling server 120 may be connected to each alternative server 130, the electronic device 110 with a client may be connected to the scheduling server 120, specifically, the connection between the scheduling server 120 and the alternative server 130 may be implemented through a wired network or a wireless network, and the connection between the electronic device 110 with a client and the scheduling server 120 may also be implemented through a wired network or a wireless network. The electronic device 110 with the client installed may be a client capable of communicating with the scheduling server 120, and the electronic device 110 may be a mobile phone, a computer, a tablet computer, or the like.
Specifically, a client installed on the electronic device 110 may request the scheduling server 120 to allocate a target server to the client, and accordingly, the scheduling server 120 may select the target server for the client from the managed alternative servers 130, and return a response message to the client, where the response message may include an address of the target server and a preset flag indicating a transmission protocol supported by the target server, so that the client may send a message to be processed to the target server based on the transmission protocol supported by the target server, thereby avoiding a problem that a transmission protocol adopted when sending the message is not matched with the transmission protocol supported by the target server, which results in a message processing failure, and further improving a success rate of message processing.
Fig. 1-2 is a flowchart of steps of a message sending method provided in an embodiment of the present invention, which is applied to a system including a client and a scheduling server, and as shown in fig. 1-2, the method may include:
step 101, the client sends an access request message to the scheduling server.
In the embodiment of the present invention, the client may be a client installed on an electronic device such as a terminal, a mobile phone, a computer, a tablet computer, and the like, the scheduling server may manage a plurality of alternative servers for processing messages sent by the client, and the target server may be a server selected by the scheduling server from the plurality of alternative servers managed by the scheduling server for processing messages subsequently sent by the client.
Further, in an actual application scenario, there are often multiple clients, and since the number of messages sent by each client is large, if the messages of the clients are directly sent to a server for processing the messages, the load on the server may be large, and the normal operation of the server is affected, in the embodiment of the present invention, before the clients send the messages, the clients send access request messages to a scheduling server first, so that the scheduling server determines a target server for the clients, and accordingly, after the scheduling server determines the target server, the scheduling server can send the address of the target server to the clients. It should be noted that the access request message may be sent based on a low version HTTP protocol to ensure that the dispatch server can respond to the access request message normally.
Step 102, after receiving the access request message, the scheduling server selects a target server from the managed alternative servers.
In the embodiment of the present invention, after receiving the access request message, the scheduling server may determine that the client has a message that needs to be processed, and therefore, a target server for processing the message may be determined for the client according to the processing parameter of each managed alternative server. Specifically, the processing parameters of the candidate server may be load of the server, occupation amount of the processor, and the like, the scheduling server may determine the candidate server with a smaller processing parameter as the target server, and for example, the scheduling server may select the candidate server with a smaller load as the target server, so that the message sent by the client is processed by the target server, thereby avoiding a problem that the message cannot be normally processed due to an excessively large load of the target server.
103, the dispatching server generates a response message according to the transmission protocol supported by the target server and the address of the target server; the response message contains the address of the target server and a preset mark representing the transmission protocol supported by the target server.
In this embodiment of the present invention, the response message is a message used by the scheduling server to respond to the access request message sent by the client, the address of the target server may be an Internet Protocol (IP) address of the target server, and the transmission Protocol supported by the target server may be a high-version HTTP Protocol or a low-version HTTP Protocol.
Further, since the high version HTTP protocol is more optimized, it has more advantages, such as: header compression, multiplexing, etc. may be performed at the time of transmission, and accordingly, if transmission is performed based on the high-version HTTP protocol, the overall efficiency may be high during transmission. However, different servers support different transmission protocols, and some servers may not support the high-version HTTP protocol but do not support the high-version HTTP protocol, and therefore, in order to avoid a problem of failure in message processing, in an embodiment of the present invention, a scheduling server adds a preset flag indicating a transmission protocol supported by a target server to a response message, so that a client can transmit a message to the target server using the transmission protocol supported by the target server, and thus the transmitted message can be normally processed.
And step 104, the dispatching server sends the response message to the client.
In the embodiment of the invention, the scheduling server can acquire the address of the electronic equipment where the client is located based on the access request message sent by the client, and then returns the response message to the address, thereby realizing sending the response message to the client.
And 105, the client receives the response message returned by the scheduling server.
In the embodiment of the present invention, the client may receive the response message, so as to determine the address of the target server and the transport protocol supported by the target server.
And 106, the client sends a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark.
In the embodiment of the invention, the client sends the message to be processed to the target server by using the transmission protocol supported by the target server, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when the message is sent and the transmission protocol supported by the target server can be avoided.
In summary, in the message sending method provided by the embodiment of the present invention, the client may send the access request message to the scheduling server, the access request message may be used to obtain the address of the target server from the dispatch server, which, after receiving the access request message, the target server may be determined based on the processing parameters of each alternative server managed by the scheduling server, generating a response message according to the transmission protocol supported by the target server and the address of the target server, the response message contains the address of the target server and a preset flag indicating the transport protocol supported by the target server, the dispatch server may then send a response message to the client, which may receive the response message returned by the dispatch server, and, and sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server. Compared with the prior art in which the client directly sends the message to be processed to the target server based on the default transmission protocol, in the embodiment of the invention, the scheduling server adds the transmission protocol supported by the target server in the response message, and accordingly, the client sends the message to be processed to the target server based on the transmission protocol supported by the target server, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when sending the message and the transmission protocol supported by the target server can be avoided, and the success rate of message processing is further improved.
Fig. 2 is a flowchart of steps of another message sending method provided in an embodiment of the present invention, which is applied to a scheduling server, and as shown in fig. 2, the method may include:
step 201, after receiving the access request message sent by the client, selecting a target server from the managed alternative servers.
Specifically, this step may refer to step 102, which is not described herein again in this embodiment of the present invention.
Step 202, generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message contains the address of the target server and a preset mark representing the transmission protocol supported by the target server.
Specifically, this step may refer to step 103, which is not described herein again in this embodiment of the present invention.
Step 203, sending the response message to the client.
Specifically, this step may refer to step 104, which is not described herein again in this embodiment of the present invention.
In summary, in another message sending method provided in the embodiments of the present invention, after receiving an access request message sent by a client, a scheduling server may determine a target server according to a processing parameter of each candidate server managed by the scheduling server, then generate a response message according to a transmission protocol supported by the target server and an address of the target server, where the response message includes the address of the target server and a preset flag indicating the transmission protocol supported by the target server, and finally send the response message to the client. Compared with the prior art in which the client directly sends the message to be processed to the target server based on the default transport protocol, in the embodiment of the invention, the scheduling server enables the client to send the message to be processed to the target server based on the transport protocol supported by the target server by adding the transport protocol supported by the target server to the response message, so that the problem of message processing failure caused by mismatching of the transport protocol adopted when sending the message and the transport protocol supported by the target server can be avoided, and the success rate of message processing is improved.
Fig. 3 is a flowchart of steps of another message sending method provided in an embodiment of the present invention, which is applied to a client, and as shown in fig. 3, the method may include:
step 301, sending an access request message to a dispatch server.
Specifically, this step may refer to step 101 described above, and details of the embodiment of the present invention are not described herein.
Step 302, receiving a response message returned by the dispatch server; the response message contains the address of the target server and a preset mark representing the transmission protocol supported by the target server.
Specifically, this step may refer to step 104, which is not described herein again in this embodiment of the present invention.
And step 303, sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server indicated by the preset mark.
Specifically, the step may refer to the step 105, and details of the embodiment of the present invention are not described herein.
In summary, according to another message sending method provided in the embodiments of the present invention, a client may send an access request message to a scheduling server, and then may receive a response message returned by the scheduling server, where the response message includes an address of a target server and a preset flag indicating a transmission protocol supported by the target server, and finally, according to the address of the target server, a message to be processed may be sent to the target server based on the transmission protocol supported by the target server. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for processing the message can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of the message processing by the mode that the client sends the message to be processed to the target server based on the transmission protocol supported by the target server.
Fig. 4-1 is a flowchart illustrating steps of another message sending method according to an embodiment of the present invention, and as shown in fig. 4-1, the method may include:
step 401, the client sends an access request message to the scheduling server.
In this step, when the client interacts with the scheduling server, the access request message may be transmitted based on the low-version HTTP protocol, so that a high-version HTTP protocol does not need to be set for the scheduling server, which may reduce the setting cost, and at the same time, the scheduling server often manages more servers, and the amount of messages passing through the scheduling server may be larger, while when the scheduling server transmits based on the low-version HTTP protocol, the performance consumption of the scheduling server is lower, which may ensure the processing efficiency of the scheduling server.
Step 402, after receiving the access request message sent by the client, the scheduling server selects a target server from the managed alternative servers.
Specifically, this step may refer to step 102, which is not described herein again in this embodiment of the present invention.
Step 403, the scheduling server generates a response message according to the transmission protocol supported by the target server and the address of the target server.
Specifically, the scheduling server may generate the response message through the following substeps (1) to (2):
substep (1): the dispatch server generates a first initial message containing the address of the target server.
In this step, the first initial message may be a message, and the message may be composed of a data body and a non-data body, where the data body position is often used to store actual data to be transmitted, that is, a message text, and the non-data body position is generally used to set a check bit, an IP address, a type, and the like, and does not relate to data content to be transmitted. Accordingly, the dispatch server may generate the first initial message with the address of the target server as content in the non-data volume.
Substep (2): and the dispatching server adds a preset mark at a first preset position of the first initial message to obtain the response message.
In this step, the first preset position may be predefined according to actual requirements, for example, the first preset position may be a header of the first initial message, and by inserting a preset flag into the header, the problem that a message body in the first initial message is damaged due to insertion of the preset flag may be avoided, and integrity of data is ensured. Of course, in another alternative embodiment of the present invention, the preset flag may also be inserted into other positions of the first initial message, as long as it is ensured that the content of the message body is not damaged after the insertion at the position.
Specifically, if the transmission protocol supported by the target server is the high-version HTTP protocol, the scheduling server may add a first preset flag to the header of the first initial message. For example, the first preset flag may be "Direct H2C: 1 ", wherein the first preset flag is Direct H2C: 1, the transmission protocol supported by the target server may be a high-version HTTP protocol, and certainly, the first preset flag may also be other contents, which is not limited in this embodiment of the present invention. Further, if the transport protocol supported by the target server is the low-version HTTP protocol, the scheduling server may add a second preset flag to the header of the first initial message. For example, the second preset flag may be "Direct H2C: 0 ″, of course, the second predetermined flag may also be other contents, for example, the second predetermined flag may be null, which is not limited in the embodiment of the present invention. Wherein the second preset flag is null, or the second preset flag is Direct H2C: 0, which may indicate that the transport protocol supported by the target server is a low-version HTTP protocol.
Step 404, the dispatch server sends the response message to the client.
Accordingly, in this step, the scheduling server may transmit the response message to the client based on the low-version HTTP protocol. Therefore, the scheduling server transmits the response message based on the low-version HTTP protocol, so that the performance consumption of the scheduling server is low, and the processing efficiency of the scheduling server is further ensured.
Step 405, the client receives a response message returned by the dispatch server.
Specifically, the step may refer to the step 105, and details of the embodiment of the present invention are not described herein.
And step 406, the client sends the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark.
In this step, before the client sends the message to be processed to the target server, the transmission protocol supported by the target server may be determined through the following steps a to C:
and step A, the client extracts a field in a first preset position in the response message.
In this step, the first preset position may be a position where a preset flag is set, the first preset position may be a header of the response message, and accordingly, the client may extract a field in the header of the response message, so as to extract the field in the first preset position.
And step B, if the field in the first preset position comprises a preset identifier matched with the first preset identifier, the client determines that the transmission protocol supported by the target server is a high-version HTTP protocol. Alternatively, the first and second liquid crystal display panels may be,
and step C, if the field in the first preset position comprises a preset identification matched with a second preset identification, the client determines that the transmission protocol supported by the target server is a low-version HTTP protocol.
In the embodiment of the present invention, a first preset identifier corresponding to a high-version HTTP protocol may be defined in advance in the client, for example, "Direct H2C: 1 "and a second preset identifier corresponding to the low version HTTP protocol, such as" Direct H2C: 0 ″, further, because the header of the message often carries multiple kinds of information, for example, a source port number, a destination port number, a sequence number, a determination number, and the like, fields extracted from the first preset location often are multiple, accordingly, the client may search for the fields in the first preset location, and if the first preset flag is found, it may be considered that the fields in the first preset location include a preset identifier matching the first preset identifier, and accordingly, it may be determined that the transmission protocol supported by the destination server is the high-version HTTP protocol. Or if the second preset mark is found, it may be considered that the field in the first preset position includes the preset mark matched with the second preset mark, further, the second preset mark corresponding to the low-version HTTP protocol may also be null, and correspondingly, when the field indicating the preset mark of the transmission protocol supported by the target server is not found, the client may also consider that the field in the first preset position includes the preset mark matched with the second preset mark, and thus it may be determined that the transmission protocol supported by the target server is the low-version HTTP protocol.
Further, if the transport protocol supported by the target server is the high-version HTTP protocol, the client may send the message to be processed to the target server based on the transport protocol supported by the target server by the following sub-step (3):
substep (3): and the client sends the message to be processed with the message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server.
The message format in the high-version HTTP protocol is defined by a binary (binary) format, which is closer to the tcp layer, and the two-mechanism mode makes the transmission based on the high-version HTTP protocol highly efficient and simple. Specifically, the message format in the high-version HTTP protocol includes: length, type, flags, stream id and payload, wherein length defines the beginning to the end of the whole message, type defines the type of the message, flags uses bit to define some important parameters, such as destination address, source address and the like, further, stream id is used for flow control, and payload represents the body of the message. Correspondingly, the client may adopt a message format in the high-version HTTP protocol, define the address of the target server in the flags of the message to be processed, define the message body to be sent in the payload of the message to be processed, and then send the message to be processed.
Further, if the transport protocol supported by the target server is the low-version HTTP protocol, the client may send the pending message to the target server based on the transport protocol supported by the target server through the following sub-step (4):
substep (4): and the client sends the message to be processed with the message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
The message format in the low-version HTTP protocol may include: a start line (or status line), a header and a body, wherein the start line represents the start position of the message, the header represents the header of the message, and the body represents the body of the message. Accordingly, the client may adopt a message format in the low-version HTTP protocol, define the address of the target server in the header of the message to be processed, define the body of the message to be sent in the body of the message to be processed, and then send the message to be processed.
In the embodiment of the invention, because the message to be processed is sent to the target server based on the high-version HTTP protocol, the connection between the client and the target server is reduced, and the connection overhead is reduced, therefore, when the target server supports the high-version HTTP protocol, the message to be processed is sent to the target server based on the high-version HTTP protocol, the sending efficiency of the message to be processed can be improved, when the target server supports the low-version HTTP protocol, the message to be processed is sent to the target server based on the low-version HTTP protocol, the normal processing of the message to be processed can be ensured, and the success rate of message processing is ensured. Meanwhile, in the embodiment of the invention, the alternative servers managed by the scheduling server do not need to be improved, and only the processing logics of the scheduling server and the client need to be modified, so that the scheduling server can send the response message carrying the preset mark, the client can select the response message based on the preset mark in the response message and send the message to be processed with the transmission protocol supported by the target server, the change required for realizing the method is small, and the realization cost is low. Meanwhile, only the logic of the client and the scheduling server needs to be modified correspondingly, so that other equipment in the network cannot be influenced, and the compatibility is good.
Further, if the performance of the alternative server managed by the scheduling server is unstable, in the embodiment of the present invention, the scheduling server may be configured to control the scheduling server to default to a response message and add a preset flag indicating a low-version HTTP protocol, so that the performance burden of the target server selected by the scheduling server may be reduced as much as possible, and the probability of the target server failing may be further reduced.
Further, in practical applications, there may be a case where messages sent by some devices to the server need to be transmitted based on the high-version HTTP protocol, and accordingly, the server may support upgrading of the adopted protocol while supporting the low-version HTTP protocol, so that when messages transmitted by other devices interacting with the server need to be transmitted based on the high-version HTTP protocol, message transmission can be completed normally. For example, assuming that server a supports the low-version HTTP protocol by default, but supports upgrading the adopted protocol, when a device interacting with server a requests upgrading the supported transport protocol, server a may use the high-version HTTP protocol in the subsequent interaction with the device.
Therefore, in this step, the client may generate a second initial message in a message format of the low-version HTTP protocol, then add the upgrade request field in a second preset position of the second initial message, and send the added second initial message as a to-be-processed message to the target server, that is, send the to-be-processed message in an upgrade H2C manner. The second preset position may be predefined according to actual requirements, for example, the second preset position may be a header of the initial message, and by inserting the preset flag in the header, the problem that the content of the data body in the message is damaged due to the insertion of the upgrade request field may be avoided, and the integrity of the data is ensured. Of course, the second preset position may be other positions as long as it is ensured that the content of the data body in the message is not damaged after the insertion at the position.
Further, the upgrade request field may be used to instruct the target server to switch the supported access protocol to the high-version HTTP protocol when supporting the protocol upgrade, and transmit a subsequent message based on the high-version HTTP protocol with the client, and accordingly, when the target server receives a to-be-processed message whose message format matches the message format of the low-version HTTP protocol, the target server may detect whether a second preset location of the to-be-processed message includes the upgrade request field, and if the upgrade request field exists and the target server supports the protocol upgrade, the target server may send a switch protocol message to the client, so that the client and the target server can transmit the subsequent message based on the high-version HTTP protocol. In the embodiment of the invention, when the target server supports the low-version HTTP, the client sends the message to be processed carrying the upgrading request field to the target server, so that the target server and the client can transmit subsequent messages based on the high-version HTTP when supporting the protocol upgrading, and further the subsequent transmission efficiency is improved.
Further, fig. 4-2 is a schematic process diagram of a message sending method according to an embodiment of the present invention, where fig. 4-2 takes the target server supporting the high version HTTP protocol as an example, as shown in fig. 4-2, a client may send an access request message to a scheduling server based on the low version HTTP protocol, where the access request message may be represented as: "HTTP 1.1 request", the scheduling server may then return a response message to the client, which may be expressed as: "HTTP 1.1Response (DierctH 2C: 1)", where the Response message includes an address of the target server and a preset flag indicating a transport protocol supported by the target server, and then, the client may send, to the target server, a to-be-processed message whose message format matches a message format of the high-version HTTP protocol, based on the address of the target server in the Response message, where the to-be-processed message may be represented as: "DierctH 2C Request", further, since the client is a to-be-processed message sent based on the high-version HTTP protocol supported by the target server, the target server may parse the to-be-processed message normally and return a processing result to the client, where the processing result may be represented as: "H2C response".
Further, fig. 4-3 is a schematic process diagram of another message sending method provided by the embodiment of the present invention, where fig. 4-3 takes as an example that a target server supports a low version HTTP protocol and supports protocol upgrade, as shown in fig. 4-3, a client may send an access request message to a scheduling server based on the low version HTTP protocol, and then the scheduling server may return a response message to the client, where the response message may be represented as: "HTTP 1.1Response (DierctH 2C: 0)", where the Response message includes an address of the target server and a preset flag indicating a transport protocol supported by the target server, and then, the client may send a pending message to the target server, based on the address of the target server in the Response message, where a message format of the pending message matches a message format of a low-version HTTP protocol, and the second preset location is added with an upgrade request flag, where the pending message added with the upgrade request flag may be represented as: "Upgrade H2C Request", further, since the target server supports protocol Upgrade, the target server sends a handover protocol message to the client after receiving the pending message, where the handover protocol message may be represented as: "HTTP 1.1101 Switching Protocols", accordingly, after receiving the handover protocol message, the client may send a relevant parameter setting message to the target server, where the relevant parameter setting message may be represented as: the target server may receive the relevant parameter setting message, and set the relevant parameters in the relevant parameter setting message, so that the message may be transmitted with the client based on the high-version HTTP protocol in the subsequent process, and finally the target server may analyze the message to be processed sent by the client, and return the processing result to the client.
Further, fig. 4-4 are schematic process diagrams of another message sending method provided by an embodiment of the present invention, where fig. 4-4 take as an example that a target server supports a low version HTTP protocol and does not support protocol upgrade, as shown in fig. 4-4, a client may send an access request message to a scheduling server based on the low version HTTP protocol, and then the scheduling server may return a response message to the client, where the response message may be represented as: "HTTP 1.1Response (DierctH 2C: 0), where the Response message includes an address of the target server and a preset flag indicating a transport protocol supported by the target server, and then the client may send a message format matching the message format of the low-version HTTP protocol to the target server based on the address of the target server in the Response message, and add a message to be processed with an upgrade request flag to the second preset location, and further, since the target server does not support protocol upgrade, after receiving the message to be processed, the target server may directly parse the message to be processed sent by the client, and return the processing result to the client.
In summary, according to another message sending method provided by the embodiments of the present invention, the client can send an access request message to the scheduling server, the access request message may be used to obtain the address of the target server from the dispatch server, which, after receiving the access request message, the target server may be determined based on the processing parameters of each alternative server managed by the scheduling server, generating a response message according to the transmission protocol supported by the target server and the address of the target server, the response message contains the address of the target server and a preset flag indicating the transport protocol supported by the target server, the dispatch server may then send a response message to the client, which may receive the response message returned by the dispatch server, and, and sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for sending the message to be processed can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of message processing. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for sending the message to be processed can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of message processing.
Fig. 5 is a flowchart of steps of another message sending method according to an embodiment of the present invention, where the method may be applied to a system including a client and a target server, and as shown in fig. 5, the method may include:
step 501, the client sends an access request message to the target server based on the address of the target server.
The message sending method provided by the embodiment of the invention can be applied to the situation that the client knows the address of the target server and does not need to acquire the address of the target server from the scheduling server. Specifically, the manner in which the client sends the access request message may refer to the manner in the foregoing method, and details of the embodiment of the present invention are not described herein.
Step 502, after receiving the access request message, the target server generates a response message according to a transmission protocol supported by the target server; the response message contains a preset flag indicating the transport protocol supported by the target server.
In this embodiment of the present invention, the target server may add a preset flag indicating the transport protocol supported by the target server to a preset position of the response message, where the preset position may be a header of the response message, and further, if the transport protocol supported by the target server is a high-version HTTP protocol, the target server may add a first preset flag to the header. For example, the first preset flag may be "Direct H2C: 1 ″, of course, the first preset flag may also be other contents, and this is not limited in this embodiment of the present invention. Further, if the transport protocol supported by the target server is the low-version HTTP protocol, the target server may add a second preset flag to the header. For example, the second preset flag may be "Direct H2C: 0 ″, of course, the second predetermined flag may also be other contents, for example, the second predetermined flag may be null, which is not limited in the embodiment of the present invention.
Step 503, the target server sends the response message to the client.
In this step, the target server may obtain an address of the electronic device where the client is located based on the access request message sent by the client, and then return the response message to the address, thereby sending the response message to the client.
Step 504, the client receives the response message returned by the target server.
In the embodiment of the present invention, the client may receive the response message, so as to determine the transport protocol supported by the target server.
And 505, the client sends a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark.
Specifically, the implementation manner of this step may refer to step 406, which is not described herein again in this embodiment of the present invention.
In summary, according to another message sending method provided in the embodiments of the present invention, a client may send an access request message to a target server based on an address of the target server, and after receiving the access request message, the target server may generate a response message according to a transmission protocol supported by the target server, where the response message includes a preset flag indicating the transmission protocol supported by the target server, and then the target server sends the response message to the client, and the client receives the response message returned by the target server, and finally, the client sends a to-be-processed message to the target server according to the address of the target server and based on the transmission protocol supported by the target server indicated by the preset flag. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for sending the message to be processed can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of message processing.
Fig. 6 is a flowchart of steps of another message sending method provided in an embodiment of the present invention, where the method may be applied to a target server, and as shown in fig. 6, the method may include:
601, after receiving an access request message sent by a client, generating a response message according to a transmission protocol supported by the target server; the response message contains a preset flag indicating the transport protocol supported by the target server.
Specifically, the implementation manner of this step may refer to step 502 described above, and details of the embodiment of the present invention are not described herein.
Step 602, sending the response message to the client.
Specifically, the implementation manner of this step may refer to step 503, which is not described herein again in this embodiment of the present invention.
In summary, in another message sending method provided in the embodiments of the present invention, after receiving an access request message sent by a client, a target server may generate a response message according to a transmission protocol supported by the target server, where the response message includes a preset flag indicating the transmission protocol supported by the target server, and then the response message may be sent to the client. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, in the embodiment of the invention, the target server enables the client to send the message to be processed to the target server based on the transmission protocol supported by the target server by adding the transmission protocol supported by the target server in the response message, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when the message is sent and the transmission protocol supported by the target server can be avoided, and the success rate of message processing is improved.
Fig. 7 is a block diagram of a message sending system according to an embodiment of the present invention, and as shown in fig. 7, the system 70 may include: a client 701 and a scheduling server 702;
the client 701 is configured to send an access request message to the scheduling server 702;
the scheduling server 702 is configured to, after receiving the access request message, determine a target server according to the processing parameter of each alternative server managed by the scheduling server 702;
the scheduling server 702 is configured to generate a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
the scheduling server 702 is configured to send the response message to the client 701;
the client 701 is configured to receive a response message returned by the scheduling server 702;
the client 701 is configured to send a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and indicated by the preset flag.
In summary, in the message sending system provided in the embodiments of the present invention, the client may send the access request message to the scheduling server, the access request message may be used to obtain the address of the target server from the dispatch server, which, after receiving the access request message, the target server may be determined based on the processing parameters of each alternative server managed by the scheduling server, generating a response message according to the transmission protocol supported by the target server and the address of the target server, the response message contains the address of the target server and a preset flag indicating the transport protocol supported by the target server, the dispatch server may then send a response message to the client, which may receive the response message returned by the dispatch server, and, and sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server. Compared with the prior art in which the client directly sends the message to be processed to the target server based on the default transport protocol, in the embodiment of the invention, the scheduling server adds the transport protocol supported by the target server in the response message, and accordingly, the client sends the message to be processed to the target server based on the transport protocol supported by the target server, so that the problem of message processing failure caused by mismatching of the transport protocol adopted when sending the message and the transport protocol supported by the target server can be avoided, and the success rate of message processing is improved.
Fig. 8 is a block diagram of a message sending apparatus according to an embodiment of the present invention, which is applied to a scheduling server, and as shown in fig. 8, the apparatus 80 may include:
a determining module 801, configured to select a target server from the managed alternative servers after receiving an access request message sent by a client;
a generating module 802, configured to generate a response message according to the transport protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
a sending module 803, configured to send the response message to the client.
Optionally, the generating module 802 is specifically configured to:
generating a first initial message containing an address of the target server;
and adding a preset mark at a first preset position of the first initial message to obtain the response message.
Optionally, the first preset position is a header of the initial message;
the generating module 802 is further specifically configured to:
if the transmission protocol supported by the target server is a high-version HTTP protocol, adding a first preset mark at the head of the first initial message; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, adding a second preset mark at the head of the first initial message.
Optionally, the access request message is transmitted based on a low-version HTTP protocol, and the sending module 803 is specifically configured to:
transmitting the response message to the client based on the low-version HTTP protocol.
In summary, the message sending apparatus provided in the embodiment of the present invention may, after receiving the access request message sent by the client, determine the target server according to the processing parameter of each candidate server managed by the scheduling server, generate a response message according to the transport protocol supported by the target server and the address of the target server, where the response message includes the address of the target server and a preset flag indicating the transport protocol supported by the target server, and finally send the response message to the client. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, in the embodiment of the invention, the scheduling server enables the client to send the message to be processed to the target server based on the transmission protocol supported by the target server by adding the transmission protocol supported by the target server in the response message, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when the message is sent and the transmission protocol supported by the target server can be avoided, and the success rate of message processing is improved.
Fig. 9-1 is a block diagram of another message sending apparatus provided in an embodiment of the present invention, which is applied to a client, and as shown in fig. 9-1, the apparatus 90 may include:
a first sending module 901, configured to send an access request message to a scheduling server;
a receiving module 902, configured to receive a response message returned by the scheduling server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server;
a second sending module 903, configured to send, according to the address of the target server and based on the transmission protocol supported by the target server and indicated by the preset flag, the message to be processed to the target server.
Optionally, the preset flag is set at a first preset position of the response message; fig. 9-2 is a block diagram of another message sending apparatus according to an embodiment of the present invention, and as shown in fig. 9-2, the apparatus 90 further includes:
an extracting module 904, configured to extract a field in the first preset location in the response message;
a first determining module 905, configured to determine that a transmission protocol supported by the target server is a high-version HTTP protocol if a field in the first preset location includes a preset identifier matching the first preset identifier;
a second determining module 906, configured to determine that the transmission protocol supported by the target server is a low-version HTTP protocol if a field in the first preset location includes a preset identifier matching with a second preset identifier.
Optionally, the second sending module 903 is specifically configured to:
if the transmission protocol supported by the target server is a high-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
Optionally, the second sending module 903 is further specifically configured to:
generating a second initial message in a message format of the low version HTTP protocol;
adding an upgrading request field in a second preset position of the second initial message, and sending the added second initial message serving as the message to be processed to the target server;
the upgrade request field is used for indicating the target server to switch the supported access protocol to the high-version HTTP when supporting protocol upgrade, and transmitting subsequent messages with the client based on the high-version HTTP.
In summary, the message sending apparatus provided in the embodiment of the present invention may send an access request message to the scheduling server, and then may receive a response message returned by the scheduling server, where the response message includes an address of the target server and a preset flag indicating a transmission protocol supported by the target server, and finally, may send a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for sending the message to be processed can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of message processing.
Fig. 10 is a block diagram of another message sending system according to an embodiment of the present invention, and as shown in fig. 10, the system 100 may include: a client 1001 and a target server 1002;
the client 1001 is configured to send an access request message to the target server 1002 based on the address of the target server 1002;
the target server 1002, configured to generate a response message according to a transmission protocol supported by the target server 1002 after receiving the access request message; the response message contains a preset flag indicating the transport protocol supported by the target server 1002;
the target server 1002, configured to send the response message to the client 1001;
the client 1001 is configured to receive a response message returned by the target server 1002;
the client 1001 is configured to send a message to be processed to the target server 1002 according to the address of the target server 1002 and based on the transmission protocol supported by the target server 1002 and indicated by the preset flag.
In summary, in the message sending system provided in the embodiment of the present invention, the client may send the access request message to the target server based on the address of the target server, and after receiving the access request message, the target server may generate a response message according to the transmission protocol supported by the target server, where the response message includes a preset flag indicating the transmission protocol supported by the target server, and then the target server sends the response message to the client, and the client receives the response message returned by the target server, and finally, the client sends the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server indicated by the preset flag. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, the method and the device for sending the message to be processed can avoid the problem that the message processing fails because the transmission protocol adopted when the message is sent is not matched with the transmission protocol supported by the target server and improve the success rate of message processing.
Fig. 11 is a block diagram of another message sending apparatus according to an embodiment of the present invention, which is applied to a target server, and as shown in fig. 11, the apparatus 110 may include:
a generating module 1101, configured to generate a response message according to a transmission protocol supported by the target server after receiving an access request message sent by a client; the response message comprises a preset mark representing a transmission protocol supported by the target server;
a sending module 1102, configured to send the response message to the client.
In summary, the message sending apparatus provided in the embodiment of the present invention may generate, after receiving the access request message sent by the client, a response message according to the transport protocol supported by the target server, where the response message includes a preset flag indicating the transport protocol supported by the target server, and then may send the response message to the client. Compared with the mode that the client directly sends the message to be processed to the target server based on the default transmission protocol in the prior art, in the embodiment of the invention, the target server enables the client to send the message to be processed to the target server based on the transmission protocol supported by the target server by adding the transmission protocol supported by the target server in the response message, so that the problem of message processing failure caused by mismatching of the transmission protocol adopted when the message is sent and the transmission protocol supported by the target server can be avoided, and the success rate of message processing is improved.
For the above device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiment.
Preferably, an embodiment of the present invention further provides a terminal, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements the processes of the foregoing message sending method embodiment, and can achieve the same technical effects, and details are not repeated here to avoid repetition.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the foregoing message sending method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The embodiments in the present specification are all described in a progressive manner, and each embodiment focuses on differences from other embodiments, and portions that are the same and similar between the embodiments may be referred to each other.
As is readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
The messaging methods provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The structure required to construct a system incorporating aspects of the present invention will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the messaging method according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (19)

1. A message sending method is applied to a system comprising a client and a scheduling server, and comprises the following steps:
the client sends an access request message to the scheduling server;
after receiving the access request message, the scheduling server selects a target server from the managed alternative servers; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load capacity of the alternative server and the occupation capacity of the processor;
the dispatching server generates a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
the dispatching server sends the response message to the client;
the client receives the response message returned by the scheduling server;
and the client sends a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server represented by the preset mark.
2. A message sending method, applied to a scheduling server, the method comprising:
after receiving an access request message sent by a client, selecting a target server from the managed alternative servers; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load capacity of the alternative server and the occupation capacity of the processor;
generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
and sending the response message to the client.
3. The method of claim 2, wherein generating the response message according to the transport protocol supported by the target server and the address of the target server comprises:
generating a first initial message containing an address of the target server;
and adding a preset mark at a first preset position of the first initial message to obtain the response message.
4. The method of claim 3, wherein the first preset position is a header of the initial message;
adding a preset mark at a first preset position of the first initial message to obtain the response message, wherein the step of adding a preset mark at the first preset position of the first initial message comprises:
if the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP), adding a first preset mark at the head of the first initial message; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, adding a second preset mark at the head of the first initial message.
5. The method of claim 2, wherein the access request message is transmitted based on a low-version HTTP protocol, and wherein sending the response message to the client comprises:
transmitting the response message to the client based on the low-version HTTP protocol.
6. A message sending method is applied to a client side, and the method comprises the following steps:
sending an access request message to a scheduling server;
receiving a response message returned by the scheduling server; the response message comprises an address of a target server and a preset mark representing a transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load of the alternative server and the occupation amount of the processor.
7. The method of claim 6, wherein the preset flag is set at a first preset position of the response message; before sending the message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and indicated by the preset flag, the method further includes:
extracting a field in the first preset position in the response message;
if the field in the first preset position comprises a preset identifier matched with the first preset identifier, determining that the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP); alternatively, the first and second electrodes may be,
and if the field in the first preset position comprises a preset identifier matched with a second preset identifier, determining that the transmission protocol supported by the target server is a low-version HTTP protocol.
8. The method according to claim 7, wherein the sending the message to be processed to the target server according to the address of the target server and based on the transport protocol supported by the target server indicated by the preset flag comprises:
if the transmission protocol supported by the target server is a high-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server; alternatively, the first and second liquid crystal display panels may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
9. The method of claim 8, wherein sending the pending message to the target server with a message format matching the message format of the low-version HTTP protocol based on the address of the target server comprises:
generating a second initial message in a message format of the low version HTTP protocol;
adding an upgrading request field in a second preset position of the second initial message, and sending the added second initial message serving as the message to be processed to the target server;
the upgrading request field is used for indicating the target server to switch a supported access protocol to the high-version HTTP protocol when the target server supports protocol upgrading, and transmitting subsequent messages with the client based on the high-version HTTP protocol.
10. A messaging system, comprising: a client and a scheduling server;
the client is used for sending an access request message to the scheduling server;
the scheduling server is used for selecting a target server from the managed alternative servers after receiving the access request message; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load capacity of the alternative server and the occupation capacity of the processor;
the dispatching server is used for generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
the scheduling server is used for sending the response message to the client;
the client is used for receiving the response message returned by the scheduling server;
and the client is used for sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server represented by the preset mark.
11. A message transmission apparatus, applied to a scheduling server, the apparatus comprising:
the determining module is used for selecting a target server from the managed alternative servers after receiving an access request message sent by the client; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load capacity of the alternative server and the occupation capacity of the processor;
the generating module is used for generating a response message according to the transmission protocol supported by the target server and the address of the target server; the response message comprises the address of the target server and a preset mark representing the transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
and the sending module is used for sending the response message to the client.
12. The apparatus of claim 11, wherein the generating module is specifically configured to:
generating a first initial message containing an address of the target server;
and adding a preset mark at a first preset position of the first initial message to obtain the response message.
13. The apparatus of claim 12, wherein the first preset position is a header of the initial message;
the generating module is further specifically configured to:
if the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP), adding a first preset mark at the head of the first initial message; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, adding a second preset mark at the head of the first initial message.
14. The apparatus according to claim 11, wherein the access request message is transmitted based on a low-version HTTP protocol, and the sending module is specifically configured to:
transmitting the response message to the client based on the low-version HTTP protocol.
15. A message transmission apparatus, applied to a client, the apparatus comprising:
the first sending module is used for sending an access request message to the scheduling server;
the receiving module is used for receiving a response message returned by the scheduling server; the response message comprises an address of a target server and a preset mark representing a transmission protocol supported by the target server; the response message is obtained by adding the preset identification at a first preset position of a first initial message of the target server according to the version of a transmission protocol supported by the target server;
the second sending module is used for sending a message to be processed to the target server according to the address of the target server and based on the transmission protocol supported by the target server and represented by the preset mark; the target server determines selection according to the processing parameters of the alternative servers; the processing parameters are the load of the alternative server and the occupation amount of the processor.
16. The apparatus according to claim 15, wherein the preset flag is set at a first preset position of the response message; the device further comprises:
the extracting module is used for extracting the field in the first preset position in the response message;
the first determining module is used for determining that the transmission protocol supported by the target server is a high-version hypertext transfer protocol (HTTP) if the field in the first preset position comprises a preset identifier matched with the first preset identifier; alternatively, the first and second electrodes may be,
and the second determining module is used for determining that the transmission protocol supported by the target server is a low-version HTTP (hyper text transport protocol) if the field in the first preset position comprises a preset identifier matched with a second preset identifier.
17. The apparatus of claim 16, wherein the second sending module is specifically configured to:
if the transmission protocol supported by the target server is a high-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the high-version HTTP protocol to the target server based on the address of the target server; alternatively, the first and second electrodes may be,
and if the transmission protocol supported by the target server is a low-version HTTP protocol, sending a message to be processed with a message format matched with the message format of the low-version HTTP protocol to the target server based on the address of the target server.
18. The apparatus of claim 17, wherein the second sending module is further specifically configured to:
generating a second initial message in a message format of the low version HTTP protocol;
adding an upgrading request field in a second preset position of the second initial message, and sending the added second initial message serving as the message to be processed to the target server;
the upgrade request field is used for indicating the target server to switch the supported access protocol to the high-version HTTP when supporting protocol upgrade, and transmitting subsequent messages with the client based on the high-version HTTP.
19. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, implements a message sending method according to any one of claims 1 to 9.
CN201910459451.4A 2019-05-29 2019-05-29 Message sending method, device, system and computer readable storage medium Active CN110324405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910459451.4A CN110324405B (en) 2019-05-29 2019-05-29 Message sending method, device, system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910459451.4A CN110324405B (en) 2019-05-29 2019-05-29 Message sending method, device, system and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110324405A CN110324405A (en) 2019-10-11
CN110324405B true CN110324405B (en) 2022-05-17

Family

ID=68119176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910459451.4A Active CN110324405B (en) 2019-05-29 2019-05-29 Message sending method, device, system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110324405B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112751812A (en) * 2019-10-31 2021-05-04 北京京东振世信息技术有限公司 Method and device for self-adapting application protocol
CN111787048B (en) * 2020-04-28 2023-08-04 北京沃东天骏信息技术有限公司 Connection method of terminal equipment, scheduling server and Internet of things system
CN113965628A (en) * 2020-12-03 2022-01-21 广州三叠纪元智能科技有限公司 Message scheduling method, server and storage medium
CN114979284B (en) * 2021-04-27 2023-06-30 中移互联网有限公司 5G message scheduling method, device and system
CN114640679A (en) * 2022-03-14 2022-06-17 京东科技信息技术有限公司 Data packet transmission method and device, storage medium and electronic equipment
CN117097813B (en) * 2023-10-19 2024-01-26 广州宇中网络科技有限公司 Protocol adaptation method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567882A (en) * 2003-06-12 2005-01-19 华为技术有限公司 A method for accessing server group
CN101030873A (en) * 2007-02-15 2007-09-05 深圳市迅雷网络技术有限公司 Method and system for downloading data
CN101043523A (en) * 2006-03-21 2007-09-26 腾讯科技(深圳)有限公司 Login method, system and proxy server of instant message server
CN101808118A (en) * 2010-03-02 2010-08-18 浪潮(北京)电子信息产业有限公司 Access method, device and system of server
CN102075445A (en) * 2011-02-28 2011-05-25 杭州华三通信技术有限公司 Load balancing method and device
CN102098354A (en) * 2011-02-28 2011-06-15 北京星网锐捷网络技术有限公司 Method and server for allocating dynamic host configuration protocol (DHCP) addresses
CN109150904A (en) * 2018-09-25 2019-01-04 深圳市佰仟金融服务有限公司 Interface service call method and terminal device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8463998B1 (en) * 2002-12-13 2013-06-11 Open Text S.A. System and method for managing page variations in a page delivery cache

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567882A (en) * 2003-06-12 2005-01-19 华为技术有限公司 A method for accessing server group
CN101043523A (en) * 2006-03-21 2007-09-26 腾讯科技(深圳)有限公司 Login method, system and proxy server of instant message server
CN101030873A (en) * 2007-02-15 2007-09-05 深圳市迅雷网络技术有限公司 Method and system for downloading data
CN101808118A (en) * 2010-03-02 2010-08-18 浪潮(北京)电子信息产业有限公司 Access method, device and system of server
CN102075445A (en) * 2011-02-28 2011-05-25 杭州华三通信技术有限公司 Load balancing method and device
CN102098354A (en) * 2011-02-28 2011-06-15 北京星网锐捷网络技术有限公司 Method and server for allocating dynamic host configuration protocol (DHCP) addresses
CN109150904A (en) * 2018-09-25 2019-01-04 深圳市佰仟金融服务有限公司 Interface service call method and terminal device

Also Published As

Publication number Publication date
CN110324405A (en) 2019-10-11

Similar Documents

Publication Publication Date Title
CN110324405B (en) Message sending method, device, system and computer readable storage medium
US20200382374A1 (en) Method for generating network slice template and for applying network slice template, and apparatus
CN103942225B (en) A kind of resource transfer method, client and the system of mixed type applications client
US11184465B2 (en) Network communication for establishing a QUIC connection
CN103944994A (en) Distributed resource obtaining method and device
CN107146623B (en) Speech recognition method, device and system based on artificial intelligence
CN110297944B (en) Distributed XML data processing method and system
US11838381B2 (en) Device cross-area access method, electronic device, and non-transitory computer-readable storage medium
CN104618444A (en) Reverse agent server processing request based method and device
CN114449458B (en) 5G message fallback method, system, computing device and storage medium
CN109067860B (en) Mobile terminal message processing method and related device
CN110149299A (en) A kind of method for optimizing video, device and system, terminal and the network equipment
CN103701867A (en) Method, system and central server for processing call requests
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
US8880108B2 (en) Short message processing method and apparatus
CN112422450B (en) Computer equipment, and flow control method and device for service request
CN105099769A (en) Method, device and system for processing abnormal operations of service platform
CN105141653A (en) Method, equipment and system for data interaction of service platform
CN107295003B (en) Data transmission method, device and system
CN105556918B (en) A kind of resource downloading method and electronic equipment
CN106302093B (en) Communication method, system and server
CN108512889B (en) Application response pushing method based on HTTP and proxy server
CN108134811B (en) Method, device and system for distributing or downloading target file
CN101420392A (en) Method and customer terminal for instant communication customer terminal displaying pop-up window
WO2019242279A1 (en) Message processing method and device

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
GR01 Patent grant
GR01 Patent grant