CN108055311B - HTTP asynchronous request method, device, server, terminal and storage medium - Google Patents

HTTP asynchronous request method, device, server, terminal and storage medium Download PDF

Info

Publication number
CN108055311B
CN108055311B CN201711288020.3A CN201711288020A CN108055311B CN 108055311 B CN108055311 B CN 108055311B CN 201711288020 A CN201711288020 A CN 201711288020A CN 108055311 B CN108055311 B CN 108055311B
Authority
CN
China
Prior art keywords
response result
result data
request
response
request information
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
CN201711288020.3A
Other languages
Chinese (zh)
Other versions
CN108055311A (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.)
CHANJET INFORMATION TECHNOLOGY CO LTD
Original Assignee
CHANJET INFORMATION 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 CHANJET INFORMATION TECHNOLOGY CO LTD filed Critical CHANJET INFORMATION TECHNOLOGY CO LTD
Priority to CN201711288020.3A priority Critical patent/CN108055311B/en
Publication of CN108055311A publication Critical patent/CN108055311A/en
Application granted granted Critical
Publication of CN108055311B publication Critical patent/CN108055311B/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]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a HTTP asynchronous request method, a device, a server, a terminal and a storage medium, wherein the HTTP asynchronous request method comprises the following steps: receiving HTTP request information sent by a client; generating corresponding response result data according to the HTTP request information, and adding the response result data into a response queue; and when receiving the data request information of the calling response result of the client, connecting and returning the response result data in the response queue to the client through the data request of the calling response result corresponding to the data request information of the calling response result within the preset time. According to the technical scheme, on one hand, the limitation of the client browser on the number of concurrent connections is broken through, on the other hand, the problems of response result data loss and wrong throwing in the case of network disconnection and reconnection are reduced, on the other hand, the timeliness of response result data calling is improved, and the problem of data interaction pressure caused by the fact that HTTP request connection is kept for a long time and the number of server connections is too large is reduced.

Description

HTTP asynchronous request method, device, server, terminal and storage medium
Technical Field
The present invention relates to the field of data transmission technologies, and in particular, to an HTTP asynchronous request method, an HTTP asynchronous request apparatus, a server, a terminal, and a computer-readable storage medium.
Background
Http (hyper Text Transfer protocol), a hypertext Transfer protocol, is a stateless, unidirectional protocol. An HTTP request is sent to a server, the server receives and processes the request, and sends back a response after the request is completed, in the processing process of the server, the client and the server need to maintain the HTTP connection, or an HTTP asynchronous request is adopted, and HTTP asynchronous request response results are returned in a short polling mode, a long polling mode and a long connection mode, so that the following technical defects exist:
(1) one port is opened in each HTTP connection, and the port resources of the system are rapidly occupied under the condition that a plurality of HTTP connections are large and concurrent, so that a new HTTP connection cannot be established; generally, a browser has a concurrent request number limit, and under an application scene that a plurality of requests need to be sent simultaneously, such as a display page of an application program, the phenomenon that the requests exceeding the concurrent request number limit are not sent out, so that the browser is jammed, breaks down, and the like can occur; under the cloud application scene, because the security protection can carry out the processing of network disconnection and reconnection on the connection kept for a long time through the network basic setting layer, the complex calculation result submitted by a user can not be correctly responded and returned easily.
(2) The method adopts the HTTP asynchronous request, returns the response result of the HTTP asynchronous request in a short polling mode, and realizes the loading of data by submitting a new request to the server at regular time, so that the real-time effect is poor, the connection to the server needs to be continuously established, and the pressure to the server is higher; adopting an HTTP asynchronous request, returning an HTTP asynchronous request response result in a long polling mode, blocking the request when no data exists, returning the request until new data is generated or the request is overtime, then reestablishing connection by a client to acquire data, occupying server port resources for a long time, and having higher pressure on a server when a plurality of concurrent requests exist at the same client; the HTTP asynchronous request is adopted, the response result of the HTTP asynchronous request is returned in a long connection mode, full-duplex communication is carried out between the client and the server, and the server cannot bear huge full-duplex communication connection under the condition of large amount of concurrency.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, it is an object of the present invention to provide an HTTP asynchronous request method.
Another object of the present invention is to provide an HTTP asynchronous requesting device.
It is yet another object of the present invention to provide a server.
It is yet another object of the present invention to provide a terminal.
It is yet another object of the present invention to provide a computer-readable storage medium.
In order to achieve the above object, a technical solution of a first aspect of the present invention provides an HTTP asynchronous request method, which is applied to a server and includes: receiving HTTP request information sent by a client; generating corresponding response result data according to the HTTP request information, and adding the response result data into a response queue; and when receiving the data request information of the calling response result of the client, connecting and returning the response result data in the response queue to the client through the data request of the calling response result corresponding to the data request information of the calling response result within the preset time.
In the technical scheme, a basis is provided for the generation of response result data by receiving HTTP request information sent by a client, corresponding response result data is generated according to the HTTP request information and is added into a response queue, so that the response result data can quickly enter the response queue waiting for being called and returned after being generated, the response result data can be returned to the client in time, when the calling response result data request information of the client is received, the response result data in the response queue is returned to the client through the calling response result data request connection corresponding to the calling response result data request information in a preset time, on one hand, the client can only keep the calling response result data request connection with a server at the same time to return the response result data in the response queue, and the limitation of the client, such as a browser, on the number of concurrent connections is broken through, on the other hand, the HTTP request information is separated from the transfer response result data request information, the transfer response result data request information does not depend on the HTTP request information, a network disconnection and reconnection strategy of a network layer does not influence the transfer response result data request information to establish transfer response result data request connection, the problems of response result data loss and wrong throwing during network disconnection and reconnection are reduced, on the other hand, the timeliness of response result data transfer is improved, and the problem of data interaction pressure caused by the fact that the number of server side connections is too large due to long-time HTTP request connection keeping is reduced.
It should be noted that, after the server receives the HTTP request information sent by the client, the connection corresponding to the HTTP request information is broken and does not need to be maintained, and when the server receives the fetch response result data request information of the client, the fetch response result data request connection corresponding to the fetch response result data request information is maintained within the preset time. The preset time may be 1s to 20 s.
In the above technical solution, preferably, when receiving a data request message of a retrieval response result from a client, within a preset time, the retrieving response result data request corresponding to the data request message of the retrieval response result is connected to the response result data returned to the response queue to the client, including: when receiving the data request information of the retrieval response result of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the data request connection of the retrieval response result, removing at least one response result data in the response queue and finally breaking the data request connection of the retrieval response result.
In the technical scheme, when the request information of the response result data of the client is received, if the response queue has the response result data, at least one response result data in the response queue is immediately connected and returned to the client through the request of the response result data, so that the timeliness of the response result data calling is improved, the response result data returned by calling is removed from the response queue, the repeated calling of the response result data is favorably reduced, the resource space occupation of the server is saved, the connection of the response result data calling is terminated after the response result data is called and returned, the problem of data interaction pressure caused by excessive connection number of the server due to the fact that the client and the server are connected for a long time is reduced, and the HTTP fluency of asynchronous request data interaction under the scenes of cloud application and the like is improved.
It should be noted that, when receiving the data request information of the invocation response result of the client, the connection of the invocation response result data request may be disconnected by returning one response result data in the response queue, the connection of the invocation response result data request may be maintained for a certain time, the response result data in the response queue may be returned as much as possible, and the connection of the invocation response result data request may be maintained until all the response result data in the response queue are returned, and then the connection of the invocation response result data request may be disconnected.
In any one of the above technical solutions, preferably, when receiving invocation response result data request information of the client, within a preset time, connecting and returning response result data in the response queue to the client via an invocation response result data request corresponding to the invocation response result data request information, including: when receiving a request message of calling response result data from a client, if no response result data exists in a response queue, waiting and starting timing; if the timing duration is less than or equal to the preset time, response result data are added into the response queue, the response result data are immediately returned to the client through the connection of the calling response result data request, the response result data are removed from the response queue, the connection of the calling response result data request is finally disconnected, and the timing is terminated; and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, ending the connection of the response result data calling request and timing immediately.
In the technical scheme, when receiving the request information of the response result data of the client, if no response result data exists in the response queue, waiting and starting timing, keeping the connection of the request of the response result data, if the response result data is added into the response queue within the preset time, immediately returning the response result data to the client through the connection of the request of the response result data, which is beneficial to further improving the timeliness of the response result data calling and reducing the data interaction pressure, and reducing the repeated calling of the response result data by removing the response result data which is called and returned in the response queue, thereby saving the resource space occupation of the server, and reducing the problem of excessive data interaction pressure of the number of server connections caused by the long-time connection between the client and the server by terminating the connection of the response result data calling and returning in the response queue, the method and the device improve the fluency of HTTP asynchronous request data interaction in scenes such as cloud application, and if no response result data is added into the response queue within the preset time, the connection of the response result data calling request is immediately terminated, so that the problem of data interaction pressure caused by excessive server connection number due to long-time connection between the client and the server is solved, and the fluency of HTTP asynchronous request data interaction in scenes such as cloud application is improved.
The technical solution of the second aspect of the present invention provides an HTTP asynchronous request method, which is applicable to a client, and includes: sending HTTP request information to a server, and adding the HTTP request information into a preset request pool; serially sending request information of calling response result data to a server according to the number of HTTP request information in a preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data; and receiving response result data returned by the server, and removing HTTP request information corresponding to the response result data from the preset request pool.
In the technical scheme, the HTTP request information is sent to the server side and added into the preset request pool, so that the record statistics of the total HTTP request information is realized, the omission of the retrieval response result data is favorably reduced, the retrieval response result data request information is serially sent to the server side according to the number of the HTTP request information in the preset request pool, the retrieval response result data request connection is kept, the server side returns the response result data through the retrieval response result data request connection, the response result data returned by the server side is received, the HTTP request information corresponding to the response result data is removed from the preset request pool, the retrieval response result data request information is favorably reduced by repeatedly initiating retrieval, the resource space occupation of the client side is saved, on one hand, the client side and the server side can simultaneously only keep one retrieval response result data request connection, the response result data in the response queue is returned, the limitation of a client, such as a browser, on the number of concurrent connections is broken through, on the other hand, HTTP request information is separated from the request information of the invoking response result data, the request information of the invoking response result data does not depend on the HTTP request information, the network disconnection reconnection strategy of a network layer does not influence the request information of the invoking response result data to establish the data request connection of the invoking response result data, and the problems of response result data loss and error throwing during network disconnection reconnection are reduced.
It should be noted that the preset request pool may be at the client, and the retrieval response result data request information of the number of HTTP request information in the preset request pool may be serially transmitted one by one.
In the above technical solution, preferably, after receiving response result data returned by the server and removing HTTP request information corresponding to the response result data from the preset request pool, the method further includes: judging whether HTTP request information exists in a preset request pool or not; if the HTTP request information does not exist in the preset request pool, all the data request connections for calling response results are disconnected; and if the HTTP request information exists in the preset request pool, serially transmitting the request information of the calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the connection of the request information of the calling response result data so that the server can return the response result data.
In the technical scheme, by judging whether HTTP request information exists in a preset request pool or not, when judging that the HTTP request information does not exist in the preset request pool, all invoking response result data request connections are disconnected, the problem of data interaction pressure caused by the fact that a client is kept connected with a server for a long time, and the number of server connections is too large is solved, the fluency of HTTP asynchronous request data interaction under the scenes of cloud application and the like is improved, when judging that the HTTP request information exists in the preset request pool, invoking response result data request information is continuously sent to the server in series according to the number of the HTTP request information in the preset request pool, invoking response result data request connections are kept, so that the server returns response result data, the response result data are continuously invoked, all the HTTP request information is centrally managed in the preset request pool, invoking response result data request information is initiated as required, the method and the device have the advantages that the returned response result data are called in real time, meanwhile, the waste of the server resources caused by excessive polling and overlong continuous connection is reduced, the overall response speed is improved, and the service capability and performance of the server in the cloud application are improved.
The technical solution of the third aspect of the present invention provides an HTTP asynchronous request apparatus, which is suitable for a server, and includes: the receiving unit is used for receiving HTTP request information sent by the client; the generating unit is used for generating corresponding response result data according to the HTTP request information and adding the response result data into the response queue; and the return unit is used for connecting and returning the response result data in the response queue to the client through the calling response result data request corresponding to the calling response result data request information within the preset time when the calling response result data request information of the client is received.
In the technical scheme, a basis is provided for the generation of response result data by receiving HTTP request information sent by a client, corresponding response result data is generated according to the HTTP request information and is added into a response queue, so that the response result data can quickly enter the response queue waiting for being called and returned after being generated, the response result data can be returned to the client in time, when the calling response result data request information of the client is received, the response result data in the response queue is returned to the client through the calling response result data request connection corresponding to the calling response result data request information in a preset time, on one hand, the client can only keep the calling response result data request connection with a server at the same time to return the response result data in the response queue, and the limitation of the client, such as a browser, on the number of concurrent connections is broken through, on the other hand, the HTTP request information is separated from the transfer response result data request information, the transfer response result data request information does not depend on the HTTP request information, a network disconnection and reconnection strategy of a network layer does not influence the transfer response result data request information to establish transfer response result data request connection, the problems of response result data loss and wrong throwing during network disconnection and reconnection are reduced, on the other hand, the timeliness of response result data transfer is improved, and the problem of data interaction pressure caused by the fact that the number of server side connections is too large due to long-time HTTP request connection keeping is reduced.
It should be noted that, after the server receives the HTTP request information sent by the client, the connection corresponding to the HTTP request information is broken and does not need to be maintained, and when the server receives the fetch response result data request information of the client, the fetch response result data request connection corresponding to the fetch response result data request information is maintained within the preset time. The preset time may be 1s to 20 s.
In the above technical solution, preferably, the return unit is further configured to: when receiving the data request information of the retrieval response result of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the data request connection of the retrieval response result, removing at least one response result data in the response queue and finally breaking the data request connection of the retrieval response result.
In the technical scheme, when the request information of the response result data of the client is received, if the response queue has the response result data, at least one response result data in the response queue is immediately connected and returned to the client through the request of the response result data, so that the timeliness of the response result data calling is improved, the response result data returned by calling is removed from the response queue, the repeated calling of the response result data is favorably reduced, the resource space occupation of the server is saved, the connection of the response result data calling is terminated after the response result data is called and returned, the problem of data interaction pressure caused by excessive connection number of the server due to the fact that the client and the server are connected for a long time is reduced, and the HTTP fluency of asynchronous request data interaction under the scenes of cloud application and the like is improved.
It should be noted that, when receiving the data request information of the invocation response result of the client, the connection of the invocation response result data request may be disconnected by returning one response result data in the response queue, the connection of the invocation response result data request may be maintained for a certain time, the response result data in the response queue may be returned as much as possible, and the connection of the invocation response result data request may be maintained until all the response result data in the response queue are returned, and then the connection of the invocation response result data request may be disconnected.
In any one of the above technical solutions, preferably, the method further includes: the starting unit is used for waiting and starting timing if no response result data exists in the response queue when receiving the request information of calling response result data of the client; the return unit is further configured to: if the timing duration is less than or equal to the preset time, response result data are added into the response queue, the response result data are immediately returned to the client through the connection of the calling response result data request, the response result data are removed from the response queue, the connection of the calling response result data request is finally disconnected, and the timing is terminated; the return unit is further configured to: and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, ending the connection of the response result data calling request and timing immediately.
In the technical scheme, when receiving the request information of the response result data of the client, if no response result data exists in the response queue, waiting and starting timing, keeping the connection of the request of the response result data, if the response result data is added into the response queue within the preset time, immediately returning the response result data to the client through the connection of the request of the response result data, which is beneficial to further improving the timeliness of the response result data calling and reducing the data interaction pressure, and reducing the repeated calling of the response result data by removing the response result data which is called and returned in the response queue, thereby saving the resource space occupation of the server, and reducing the problem of excessive data interaction pressure of the number of server connections caused by the long-time connection between the client and the server by terminating the connection of the response result data calling and returning in the response queue, the method and the device improve the fluency of HTTP asynchronous request data interaction in scenes such as cloud application, and if no response result data is added into the response queue within the preset time, the connection of the response result data calling request is immediately terminated, so that the problem of data interaction pressure caused by excessive server connection number due to long-time connection between the client and the server is solved, and the fluency of HTTP asynchronous request data interaction in scenes such as cloud application is improved.
The technical solution of the fourth aspect of the present invention provides an HTTP asynchronous request apparatus, which is suitable for a client, and includes: the sending unit is used for sending HTTP request information to the server and adding the HTTP request information into a preset request pool; the sending unit is further configured to: serially sending request information of calling response result data to a server according to the number of HTTP request information in a preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data; and the receiving unit is used for receiving response result data returned by the server and removing HTTP request information corresponding to the response result data from the preset request pool.
In the technical scheme, the HTTP request information is sent to the server side and added into the preset request pool, so that the record statistics of the total HTTP request information is realized, the omission of the retrieval response result data is favorably reduced, the retrieval response result data request information is serially sent to the server side according to the number of the HTTP request information in the preset request pool, the retrieval response result data request connection is kept, the server side returns the response result data through the retrieval response result data request connection, the response result data returned by the server side is received, the HTTP request information corresponding to the response result data is removed from the preset request pool, the retrieval response result data request information is favorably reduced by repeatedly initiating retrieval, the resource space occupation of the client side is saved, on one hand, the client side and the server side can simultaneously only keep one retrieval response result data request connection, the response result data in the response queue is returned, the limitation of a client, such as a browser, on the number of concurrent connections is broken through, on the other hand, HTTP request information is separated from the request information of the invoking response result data, the request information of the invoking response result data does not depend on the HTTP request information, the network disconnection reconnection strategy of a network layer does not influence the request information of the invoking response result data to establish the data request connection of the invoking response result data, and the problems of response result data loss and error throwing during network disconnection reconnection are reduced.
It should be noted that the preset request pool may be at the client, and the retrieval response result data request information of the number of HTTP request information in the preset request pool may be serially transmitted one by one.
In the above technical solution, preferably, the method further includes: the judging unit is used for judging whether HTTP request information exists in the preset request pool or not; the termination unit is used for terminating all the data request connections of the calling response result if the HTTP request information does not exist in the preset request pool; the sending unit is further configured to: and if the HTTP request information exists in the preset request pool, serially transmitting the request information of the calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the connection of the request information of the calling response result data so that the server can return the response result data.
In the technical scheme, by judging whether HTTP request information exists in a preset request pool or not, when judging that the HTTP request information does not exist in the preset request pool, all invoking response result data request connections are disconnected, the problem of data interaction pressure caused by the fact that a client is kept connected with a server for a long time, and the number of server connections is too large is solved, the fluency of HTTP asynchronous request data interaction under the scenes of cloud application and the like is improved, when judging that the HTTP request information exists in the preset request pool, invoking response result data request information is continuously sent to the server in series according to the number of the HTTP request information in the preset request pool, invoking response result data request connections are kept, so that the server returns response result data, the response result data are continuously invoked, all the HTTP request information is centrally managed in the preset request pool, invoking response result data request information is initiated as required, the method and the device have the advantages that the returned response result data are called in real time, meanwhile, the waste of the server resources caused by excessive polling and overlong continuous connection is reduced, the overall response speed is improved, and the service capability and performance of the server in the cloud application are improved.
An aspect of the fifth aspect of the present invention proposes a server, which includes a processor, and the processor is configured to implement, when executing a computer program stored in a memory, the steps of the HTTP asynchronous request method as set forth in any one of the aspects of the first aspect of the present invention.
In this technical solution, the server includes a processor, and the processor is configured to implement the steps of the HTTP asynchronous request method according to any one of the solutions in the first aspect of the present invention when executing the computer program stored in the memory, so that all the beneficial effects of the HTTP asynchronous request method according to any one of the solutions in the first aspect of the present invention are achieved, and details are not described herein again.
An aspect of the sixth aspect of the present invention provides a terminal, where the terminal includes a processor, and the processor is configured to implement, when executing a computer program stored in a memory, the steps of the HTTP asynchronous request method according to any one of the aspects of the second aspect of the present invention.
In this technical solution, the terminal includes a processor, and the processor is configured to implement the steps of the HTTP asynchronous request method according to any one of the solutions in the second aspect of the present invention when executing the computer program stored in the memory, so that all the beneficial effects of the HTTP asynchronous request method according to any one of the solutions in the second aspect of the present invention are achieved, and details are not described herein again.
An aspect of the seventh aspect of the present invention proposes a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the steps of the HTTP asynchronous request method of any one of the aspects presented in the first or second aspects of the present invention.
In this embodiment, a computer-readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the HTTP asynchronous request method according to any one of the above-mentioned technical solutions of the first aspect or the second aspect of the present invention, so that the HTTP asynchronous request method has all the advantages of the HTTP asynchronous request method according to any one of the above-mentioned technical solutions of the first aspect or the second aspect of the present invention, and is not described herein again.
According to the technical scheme, HTTP request information and retrieval response result data request information are separated, retrieval response result data request information does not depend on HTTP request information, a network disconnection and reconnection strategy of a network layer does not influence retrieval response result data request information to establish retrieval response result data request connection, the problems of response result data loss and error throwing during network disconnection and reconnection are reduced, all HTTP request information is managed in a preset request pool in a centralized mode, retrieval response result data request information is initiated as required, waste of server resources caused by excessive polling and overlong continuous connection is reduced while real-time retrieval and return of response result data are guaranteed, the overall response speed is improved, the service capability and performance of a server in cloud application are improved, and the cloud application server has good universality.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 shows a schematic flow diagram of a HTTP asynchronous request method according to one embodiment of the present invention;
FIG. 2 shows a schematic flow diagram of a HTTP asynchronous request method according to another embodiment of the present invention;
FIG. 3 shows a schematic block diagram of an HTTP asynchronous request device according to one embodiment of the present invention;
FIG. 4 shows a schematic block diagram of an HTTP asynchronous request device according to another embodiment of the present invention;
FIG. 5 shows a client and server interaction diagram in an HTTP asynchronous request according to one embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
Example 1
FIG. 1 shows a schematic flow diagram of a HTTP asynchronous request method according to one embodiment of the present invention.
As shown in fig. 1, the HTTP asynchronous request method according to the embodiment of the present invention is applicable to a server, and includes:
s102, receiving HTTP request information sent by a client;
s104, generating corresponding response result data according to the HTTP request information, and adding the response result data into a response queue;
and S106, when the data request information of the calling response result of the client is received, connecting and returning the response result data in the response queue to the client through the data request of the calling response result corresponding to the data request information of the calling response result within the preset time.
In the embodiment, by receiving the HTTP request information sent by the client, a basis is provided for generating response result data, and by generating corresponding response result data according to the HTTP request information and adding the response result data into the response queue, the response result data can quickly enter the response queue waiting for retrieval and return after being generated, which is beneficial to realizing that the response result data is returned to the client in time, and by connecting the retrieval response result data corresponding to the retrieval response result data request information to the client within a preset time when the retrieval response result data request information of the client is received, on one hand, the client can only maintain the retrieval response result data request connection with the server at the same time to return the response result data in the response queue, thereby breaking through the limitation of the client, such as a browser, on the number of concurrent connections, on the other hand, the HTTP request information is separated from the transfer response result data request information, the transfer response result data request information does not depend on the HTTP request information, a network disconnection and reconnection strategy of a network layer does not influence the transfer response result data request information to establish transfer response result data request connection, the problems of response result data loss and wrong throwing during network disconnection and reconnection are reduced, on the other hand, the timeliness of response result data transfer is improved, and the problem of data interaction pressure caused by the fact that the number of server side connections is too large due to long-time HTTP request connection keeping is reduced.
It should be noted that, after the server receives the HTTP request information sent by the client, the connection corresponding to the HTTP request information is broken and does not need to be maintained, and when the server receives the fetch response result data request information of the client, the fetch response result data request connection corresponding to the fetch response result data request information is maintained within the preset time. The preset time may be 1s to 20 s.
In the foregoing embodiment, preferably, when receiving invocation response result data request information of a client, in a preset time, the invoking response result data request connection corresponding to the invocation response result data request information returns response result data in a response queue to the client through a connection, where the connection includes: when receiving the data request information of the retrieval response result of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the data request connection of the retrieval response result, removing at least one response result data in the response queue and finally breaking the data request connection of the retrieval response result.
In the embodiment, when the request information of the retrieval response result data of the client is received, if the response queue has the response result data, at least one response result data in the response queue is immediately connected and returned to the client through the retrieval response result data request, so that the retrieval timeliness of the response result data is improved, the response result data returned by retrieval is removed from the response queue, the repeated retrieval of the response result data is favorably reduced, the resource space occupation of the server is saved, the retrieval response result data request connection is terminated after the response result data is retrieved, the problem of data interaction pressure caused by the fact that the number of the server connections is too large due to the fact that the client and the server are connected for a long time is reduced, and the HTTP asynchronous request data interaction fluency under the scenes of cloud application and the like is improved.
It should be noted that, when receiving the data request information of the invocation response result of the client, the connection of the invocation response result data request may be disconnected by returning one response result data in the response queue, the connection of the invocation response result data request may be maintained for a certain time, the response result data in the response queue may be returned as much as possible, and the connection of the invocation response result data request may be maintained until all the response result data in the response queue are returned, and then the connection of the invocation response result data request may be disconnected.
In any one of the above embodiments, preferably, when receiving invocation response result data request information of the client, within a preset time, the invoking response result data request connection corresponding to the invocation response result data request information returns response result data in the response queue to the client through connection, including: when receiving a request message of calling response result data from a client, if no response result data exists in a response queue, waiting and starting timing; if the timing duration is less than or equal to the preset time, response result data are added into the response queue, the response result data are immediately returned to the client through the connection of the calling response result data request, the response result data are removed from the response queue, the connection of the calling response result data request is finally disconnected, and the timing is terminated; and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, ending the connection of the response result data calling request and timing immediately.
In the embodiment, when receiving the data request information of the calling response result of the client, if no response result data exists in the response queue, waiting and starting timing, keeping the connection of the calling response result data request, if response result data is added into the response queue within a preset time, immediately returning the response result data to the client through the connection of the calling response result data request, which is beneficial to further improving the calling timeliness of the response result data and reducing data interaction pressure, and by removing the response result data which is called and returned in the response queue, the repeated calling of the response result data is beneficial to being reduced, the resource space occupation of the server is saved, and by terminating the connection of the calling response result data request after the response result data is called and returned, the problem of excessive data interaction pressure of the server caused by long-time connection between the client and the server is reduced, the method and the device improve the fluency of HTTP asynchronous request data interaction in scenes such as cloud application, and if no response result data is added into the response queue within the preset time, the connection of the response result data calling request is immediately terminated, so that the problem of data interaction pressure caused by excessive server connection number due to long-time connection between the client and the server is solved, and the fluency of HTTP asynchronous request data interaction in scenes such as cloud application is improved.
Example 2
Fig. 2 shows a schematic flow diagram of an HTTP asynchronous request method according to another embodiment of the present invention.
As shown in fig. 2, the HTTP asynchronous request method according to the embodiment of the present invention is applicable to a client, and includes:
s202, sending HTTP request information to a server, and adding the HTTP request information into a preset request pool;
s204, serially sending request information of calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the connection of the request information of calling response result data so that the server can return response result data;
and S206, receiving response result data returned by the server, and removing HTTP request information corresponding to the response result data from the preset request pool.
In the embodiment, by sending the HTTP request information to the server and adding the HTTP request information to the preset request pool, the record statistics of the total HTTP request information is realized, which is beneficial to reducing omission of the retrieval response result data, by sending the retrieval response result data request information to the server in series according to the number of the HTTP request information in the preset request pool and maintaining the retrieval response result data request connection, by retrieving the response result data request connection, returning the response result data, by receiving the response result data returned by the server and removing the HTTP request information corresponding to the response result data in the preset request pool, which is beneficial to reducing repeatedly initiating the retrieval response result data request information, saving the resource space occupation of the client, on one hand, the client can maintain only one retrieval response result data request connection with the server at the same time, the response result data in the response queue is returned, the limitation of a client, such as a browser, on the number of concurrent connections is broken through, on the other hand, HTTP request information is separated from the request information of the invoking response result data, the request information of the invoking response result data does not depend on the HTTP request information, the network disconnection reconnection strategy of a network layer does not influence the request information of the invoking response result data to establish the data request connection of the invoking response result data, and the problems of response result data loss and error throwing during network disconnection reconnection are reduced.
It should be noted that the preset request pool may be at the client, and the retrieval response result data request information of the number of HTTP request information in the preset request pool may be serially transmitted one by one.
In the foregoing embodiment, preferably, after receiving response result data returned by the server and removing HTTP request information corresponding to the response result data from the preset request pool, the method further includes: judging whether HTTP request information exists in a preset request pool or not; if the HTTP request information does not exist in the preset request pool, all the data request connections for calling response results are disconnected; and if the HTTP request information exists in the preset request pool, serially transmitting the request information of the calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the connection of the request information of the calling response result data so that the server can return the response result data.
In the embodiment, by judging whether HTTP request information exists in the preset request pool or not, when judging that the HTTP request information does not exist in the preset request pool, all invoking response result data request connections are terminated, the problem of data interaction pressure caused by the fact that the number of server connections is too large due to the fact that the client and the server are kept connected for a long time is solved, the fluency of HTTP asynchronous request data interaction under the scenes of cloud application and the like is improved, when judging that the HTTP request information exists in the preset request pool, the invoking response result data request information is continuously sent to the server in series according to the number of the HTTP request information in the preset request pool, the invoking response result data request connections are kept for the server to return response result data, the continuous invoking of the response result data is realized, all the HTTP request information is centrally managed in the preset request pool, and the invoking response result data request information is initiated as required, the method and the device have the advantages that the returned response result data are called in real time, meanwhile, the waste of the server resources caused by excessive polling and overlong continuous connection is reduced, the overall response speed is improved, and the service capability and performance of the server in the cloud application are improved.
Example 3
Fig. 3 shows a schematic block diagram of an HTTP asynchronous requesting device 300 according to one embodiment of the present invention.
As shown in fig. 3, an HTTP asynchronous request apparatus 300 according to an embodiment of the present invention is adapted to a server, and includes: a receiving unit 302, configured to receive HTTP request information sent by a client; a generating unit 304, configured to generate corresponding response result data according to the HTTP request information, and add the response result data to the response queue; and a returning unit 306, configured to, when receiving the data request information of the invocation response result of the client, connect and return the response result data in the response queue to the client through the data request of the invocation response result corresponding to the data request information of the invocation response result within a preset time.
In the embodiment, by receiving the HTTP request information sent by the client, a basis is provided for generating response result data, and by generating corresponding response result data according to the HTTP request information and adding the response result data into the response queue, the response result data can quickly enter the response queue waiting for retrieval and return after being generated, which is beneficial to realizing that the response result data is returned to the client in time, and by connecting the retrieval response result data corresponding to the retrieval response result data request information to the client within a preset time when the retrieval response result data request information of the client is received, on one hand, the client can only maintain the retrieval response result data request connection with the server at the same time to return the response result data in the response queue, thereby breaking through the limitation of the client, such as a browser, on the number of concurrent connections, on the other hand, the HTTP request information is separated from the transfer response result data request information, the transfer response result data request information does not depend on the HTTP request information, a network disconnection and reconnection strategy of a network layer does not influence the transfer response result data request information to establish transfer response result data request connection, the problems of response result data loss and wrong throwing during network disconnection and reconnection are reduced, on the other hand, the timeliness of response result data transfer is improved, and the problem of data interaction pressure caused by the fact that the number of server side connections is too large due to long-time HTTP request connection keeping is reduced.
It should be noted that, after the server receives the HTTP request information sent by the client, the connection corresponding to the HTTP request information is broken and does not need to be maintained, and when the server receives the fetch response result data request information of the client, the fetch response result data request connection corresponding to the fetch response result data request information is maintained within the preset time. The preset time may be 1s to 20 s.
In the above embodiment, preferably, the returning unit 306 is further configured to: when receiving the data request information of the retrieval response result of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the data request connection of the retrieval response result, removing at least one response result data in the response queue and finally breaking the data request connection of the retrieval response result.
In the embodiment, when the request information of the retrieval response result data of the client is received, if the response queue has the response result data, at least one response result data in the response queue is immediately connected and returned to the client through the retrieval response result data request, so that the retrieval timeliness of the response result data is improved, the response result data returned by retrieval is removed from the response queue, the repeated retrieval of the response result data is favorably reduced, the resource space occupation of the server is saved, the retrieval response result data request connection is terminated after the response result data is retrieved, the problem of data interaction pressure caused by the fact that the number of the server connections is too large due to the fact that the client and the server are connected for a long time is reduced, and the HTTP asynchronous request data interaction fluency under the scenes of cloud application and the like is improved.
It should be noted that, when receiving the data request information of the invocation response result of the client, the connection of the invocation response result data request may be disconnected by returning one response result data in the response queue, the connection of the invocation response result data request may be maintained for a certain time, the response result data in the response queue may be returned as much as possible, and the connection of the invocation response result data request may be maintained until all the response result data in the response queue are returned, and then the connection of the invocation response result data request may be disconnected.
In any one of the above embodiments, preferably, the method further includes: a starting unit 308, configured to wait and start timing if no response result data exists in the response queue when receiving a request message for retrieving response result data from the client; the return unit 306 is further configured to: if the timing duration is less than or equal to the preset time, response result data are added into the response queue, the response result data are immediately returned to the client through the connection of the calling response result data request, the response result data are removed from the response queue, the connection of the calling response result data request is finally disconnected, and the timing is terminated; the return unit 306 is further configured to: and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, ending the connection of the response result data calling request and timing immediately.
In the embodiment, when receiving the data request information of the calling response result of the client, if no response result data exists in the response queue, waiting and starting timing, keeping the connection of the calling response result data request, if response result data is added into the response queue within a preset time, immediately returning the response result data to the client through the connection of the calling response result data request, which is beneficial to further improving the calling timeliness of the response result data and reducing data interaction pressure, and by removing the response result data which is called and returned in the response queue, the repeated calling of the response result data is beneficial to being reduced, the resource space occupation of the server is saved, and by terminating the connection of the calling response result data request after the response result data is called and returned, the problem of excessive data interaction pressure of the server caused by long-time connection between the client and the server is reduced, the method and the device improve the fluency of HTTP asynchronous request data interaction in scenes such as cloud application, and if no response result data is added into the response queue within the preset time, the connection of the response result data calling request is immediately terminated, so that the problem of data interaction pressure caused by excessive server connection number due to long-time connection between the client and the server is solved, and the fluency of HTTP asynchronous request data interaction in scenes such as cloud application is improved.
Example 4
Fig. 4 shows a schematic block diagram of an HTTP asynchronous requesting device 400 according to another embodiment of the present invention.
As shown in fig. 4, an HTTP asynchronous request apparatus 400 according to an embodiment of the present invention is applicable to a client, and includes: a sending unit 402, configured to send HTTP request information to a server, and add the HTTP request information to a preset request pool; the sending unit 402 is further configured to: serially sending request information of calling response result data to a server according to the number of HTTP request information in a preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data; the receiving unit 404 is configured to receive response result data returned by the server, and remove HTTP request information corresponding to the response result data from the preset request pool.
In the embodiment, by sending the HTTP request information to the server and adding the HTTP request information to the preset request pool, the record statistics of the total HTTP request information is realized, which is beneficial to reducing omission of the retrieval response result data, by sending the retrieval response result data request information to the server in series according to the number of the HTTP request information in the preset request pool and maintaining the retrieval response result data request connection, by retrieving the response result data request connection, returning the response result data, by receiving the response result data returned by the server and removing the HTTP request information corresponding to the response result data in the preset request pool, which is beneficial to reducing repeatedly initiating the retrieval response result data request information, saving the resource space occupation of the client, on one hand, the client can maintain only one retrieval response result data request connection with the server at the same time, the response result data in the response queue is returned, the limitation of a client, such as a browser, on the number of concurrent connections is broken through, on the other hand, HTTP request information is separated from the request information of the invoking response result data, the request information of the invoking response result data does not depend on the HTTP request information, the network disconnection reconnection strategy of a network layer does not influence the request information of the invoking response result data to establish the data request connection of the invoking response result data, and the problems of response result data loss and error throwing during network disconnection reconnection are reduced.
It should be noted that the preset request pool may be at the client, and the retrieval response result data request information of the number of HTTP request information in the preset request pool may be serially transmitted one by one.
In the above embodiment, preferably, the method further includes: a determining unit 406, configured to determine whether HTTP request information exists in the preset request pool; a terminating unit 408, configured to terminate all call response result data request connections if it is determined that the preset request pool does not have HTTP request information; the sending unit 402 is further configured to: and if the HTTP request information exists in the preset request pool, serially transmitting the request information of the calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the connection of the request information of the calling response result data so that the server can return the response result data.
In the embodiment, by judging whether HTTP request information exists in the preset request pool or not, when judging that the HTTP request information does not exist in the preset request pool, all invoking response result data request connections are terminated, the problem of data interaction pressure caused by the fact that the number of server connections is too large due to the fact that the client and the server are kept connected for a long time is solved, the fluency of HTTP asynchronous request data interaction under the scenes of cloud application and the like is improved, when judging that the HTTP request information exists in the preset request pool, the invoking response result data request information is continuously sent to the server in series according to the number of the HTTP request information in the preset request pool, the invoking response result data request connections are kept for the server to return response result data, the continuous invoking of the response result data is realized, all the HTTP request information is centrally managed in the preset request pool, and the invoking response result data request information is initiated as required, the method and the device have the advantages that the returned response result data are called in real time, meanwhile, the waste of the server resources caused by excessive polling and overlong continuous connection is reduced, the overall response speed is improved, and the service capability and performance of the server in the cloud application are improved.
Example 5
According to an embodiment of the invention, the server comprises a processor for implementing the steps of the HTTP asynchronous request method as any one of the embodiments 1 of the invention set forth above when executing the computer program stored in the memory.
In this embodiment, the server includes a processor, and the processor is configured to implement, when executing the computer program stored in the memory, the steps of the HTTP asynchronous request method according to any one of embodiments 1 of the present invention described above, so that all the beneficial effects of the HTTP asynchronous request method according to any one of embodiments 1 of the present invention described above are achieved, and details are not described here again.
Example 6
According to an embodiment of the invention, the terminal comprises a processor for implementing the steps of the HTTP asynchronous request method as set forth in any one of the above embodiments 2 of the invention when executing the computer program stored in the memory.
In this embodiment, the terminal includes a processor, and the processor is configured to implement, when executing the computer program stored in the memory, the steps of the HTTP asynchronous request method according to any one of embodiments 2 of the present invention described above, so that all the beneficial effects of the HTTP asynchronous request method according to any one of embodiments 2 of the present invention described above are achieved, and details are not described here again.
Example 7
A computer-readable storage medium according to an embodiment of the present invention is a computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements the steps of the HTTP asynchronous request method of any one of embodiments 1 or 2 of the present invention set forth above.
In this embodiment, a computer-readable storage medium stores thereon a computer program, and the computer program, when executed by a processor, implements the steps of the HTTP asynchronous request method according to any one of embodiment 1 or embodiment 2 of the present invention, so that the HTTP asynchronous request method according to any one of embodiment 1 or embodiment 2 of the present invention has all the advantages of the HTTP asynchronous request method according to any one of embodiment 1 or embodiment 2 of the present invention, and details are not described herein again.
Example 8
FIG. 5 shows a client and server interaction diagram in an HTTP asynchronous request according to one embodiment of the present invention.
As shown in fig. 5, the client has a preset request pool, receives HTTP request information and adds the HTTP request information to the preset request pool, and then according to the number of HTTP request information in the preset request pool, and if necessary, serially sending request information of calling response result data to the server end one by one, here, each time, a new data request message for the calling response result is required to be sent to the server, the data request connection for the calling response result corresponding to the previous data request message for the calling response result is terminated after the response result data is returned, after the response result data is received, finding corresponding HTTP request information in a preset request pool, removing the HTTP request information which has received response result data from the preset request pool, calling a response result data processing program, terminating when the connection of the request for calling the response result data is overtime, and re-initiating new request information for calling the response result data according to the requirement.
The server side is provided with a response queue, when receiving HTTP request information of the client side, the server side gives the HTTP request information to the server program for calculation processing, response result data after calculation processing of the server program are added into the response queue, when the server side receives retrieval response result data request information of the client side, if the response queue is provided with the response result data, the server side returns the response result data, if the response queue is not provided with the response result data, the server side waits until the response result data enter the response queue, returns the response result data or is overtime, the retrieval response result data request connection is terminated, and the client side initiates new retrieval response result data request information again according to needs.
The technical scheme of the invention is explained in detail above with reference to the accompanying drawings, and the invention provides an HTTP asynchronous request method, an HTTP asynchronous request device, a server, a terminal and a computer readable storage medium, through separation of HTTP request information and fetch response result data request information, the fetch response result data request information does not depend on the HTTP request information, a network disconnection reconnection strategy of a network layer does not influence the fetch response result data request information to establish fetch response result data request connection, the problems of response result data loss and error throwing during network disconnection reconnection are reduced, all HTTP request information is managed in a preset request pool in a centralized way, fetch response result data request information is initiated as required, and waste of excessive polling and continuous overlong connection to server resources is reduced while real-time fetch is ensured to return response result data, the overall response speed is improved, the service capability and performance of the server in the cloud application are favorably improved, and the method has good universality.
The steps in the method of the invention can be sequentially adjusted, combined and deleted according to actual needs.
The units in the device of the invention can be merged, divided and deleted according to actual needs.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by hardware instructions of a program, and the program may be stored in a computer-readable storage medium, where the storage medium includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM), or other Memory, such as a magnetic disk, or a combination thereof, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. An HTTP asynchronous request method is suitable for a server side and is characterized by comprising the following steps:
receiving HTTP request information sent by a client;
generating corresponding response result data according to the HTTP request information, and adding the response result data into a response queue;
when receiving the data request information of the calling response result of the client, in a preset time, returning the response result data in the response queue to the client through the data request connection of the calling response result corresponding to the data request information of the calling response result;
when receiving the retrieval response result data request information of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the retrieval response result data request connection, and removing the at least one response result data in the response queue and finally breaking the retrieval response result data request connection.
2. The HTTP asynchronous request method according to claim 1, wherein the returning of the response result data in the response queue to the client via a fetch response result data request connection corresponding to the fetch response result data request information within a preset time when receiving the fetch response result data request information of the client includes:
when receiving a request message of calling response result data from the client, if the response result data does not exist in the response queue, waiting and starting timing;
if the response result data is added into the response queue when the timing duration is less than or equal to the preset time, immediately returning the response result data to the client through the connection of the data request for calling response result data, removing the response result data from the response queue, and finally disconnecting the connection of the data request for calling response result data and terminating timing;
and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, terminating the connection of the request for transferring the response result data and terminating the timing immediately.
3. An HTTP asynchronous request method is suitable for a client, and is characterized by comprising the following steps:
sending HTTP request information to a server, and adding the HTTP request information into a preset request pool;
serially sending request information of calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data;
and receiving the response result data returned by the server, and removing HTTP request information corresponding to the response result data from the preset request pool.
4. The HTTP asynchronous request method according to claim 3, further comprising, after the receiving the response result data returned by the server and removing HTTP request information corresponding to the response result data from the preset request pool:
judging whether HTTP request information exists in the preset request pool or not;
if the HTTP request information does not exist in the preset request pool, all the data request connections of the calling response result are disconnected;
if the HTTP request information exists in the preset request pool, serially sending request information of calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data.
5. An HTTP asynchronous request device adapted to a server, comprising:
the receiving unit is used for receiving HTTP request information sent by the client;
the generating unit is used for generating corresponding response result data according to the HTTP request information and adding the response result data into a response queue;
a returning unit, configured to, when receiving a data request message of a retrieval response result of the client, connect and return the response result data in the response queue to the client through a data request of the retrieval response result corresponding to the data request message of the retrieval response result within a preset time; when receiving the retrieval response result data request information of the client, if the response queue has the response result data, immediately returning at least one response result data in the response queue to the client through the retrieval response result data request connection, and removing the at least one response result data in the response queue and finally breaking the retrieval response result data request connection.
6. The HTTP asynchronous request device of claim 5, further comprising:
the starting unit is used for waiting and starting timing if the response result data does not exist in the response queue when receiving the request information of the calling response result data of the client;
the return unit is further configured to: if the response result data is added into the response queue when the timing duration is less than or equal to the preset time, immediately returning the response result data to the client through the connection of the data request for calling response result data, removing the response result data from the response queue, and finally disconnecting the connection of the data request for calling response result data and terminating timing;
the return unit is further configured to: and if the response result data is not added into the response queue when the timing duration is equal to or greater than the preset time, terminating the connection of the request for transferring the response result data and terminating the timing immediately.
7. An HTTP asynchronous request device adapted for a client, comprising:
the sending unit is used for sending HTTP request information to a server and adding the HTTP request information into a preset request pool;
the sending unit is further configured to: serially sending request information of calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data;
and the receiving unit is used for receiving the response result data returned by the server and removing the HTTP request information corresponding to the response result data from the preset request pool.
8. The HTTP asynchronous request device according to claim 7, further comprising:
the judging unit is used for judging whether HTTP request information exists in the preset request pool or not;
a terminating unit, configured to terminate all the call response result data request connections if it is determined that the HTTP request information does not exist in the preset request pool;
the sending unit is further configured to: if the HTTP request information exists in the preset request pool, serially sending request information of calling response result data to the server according to the number of the HTTP request information in the preset request pool, and keeping the request connection of the calling response result data so that the server can return response result data.
9. A server, characterized in that it comprises a processor for implementing the steps of the HTTP asynchronous request method according to claim 1 or 2 when executing a computer program stored in a memory.
10. A terminal, characterized in that it comprises a processor for implementing the steps of the HTTP asynchronous request method according to claim 3 or 4 when executing a computer program stored in a memory.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the HTTP asynchronous request method according to any one of claims 1 to 4.
CN201711288020.3A 2017-12-07 2017-12-07 HTTP asynchronous request method, device, server, terminal and storage medium Active CN108055311B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711288020.3A CN108055311B (en) 2017-12-07 2017-12-07 HTTP asynchronous request method, device, server, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711288020.3A CN108055311B (en) 2017-12-07 2017-12-07 HTTP asynchronous request method, device, server, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN108055311A CN108055311A (en) 2018-05-18
CN108055311B true CN108055311B (en) 2021-03-16

Family

ID=62123389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711288020.3A Active CN108055311B (en) 2017-12-07 2017-12-07 HTTP asynchronous request method, device, server, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN108055311B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108881485A (en) * 2018-07-30 2018-11-23 中国石油化工股份有限公司 The method for ensureing the high concurrent system response time under big data packet
CN110912958A (en) * 2018-09-18 2020-03-24 中国移动通信集团重庆有限公司 HTTP connection processing method, device, equipment and medium
CN111294369B (en) * 2018-12-06 2022-06-03 阿里巴巴集团控股有限公司 Page request processing method and device and electronic equipment
CN113438284B (en) * 2021-06-09 2022-09-06 北京京东振世信息技术有限公司 Request processing method and device, electronic equipment and computer readable medium
CN114979174B (en) * 2022-04-15 2023-07-21 四川虹美智能科技有限公司 Method for processing HTTP blocking waiting step-by-step service data
CN114866556B (en) * 2022-05-25 2024-04-19 上海众源网络有限公司 Server resource request method and device, electronic equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104917833A (en) * 2015-06-08 2015-09-16 北京集奥聚合网络技术有限公司 Asynchronous information processing method based on NIO request

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100444566C (en) * 2004-02-20 2008-12-17 中兴通讯股份有限公司 Multi-user concurrent insertion device and its method
US20070005725A1 (en) * 2005-06-30 2007-01-04 Morris Robert P Method and apparatus for browsing network resources using an asynchronous communications protocol
US8200764B2 (en) * 2006-12-19 2012-06-12 International Business Machines Corporation System and method for achieving highly scalable real-time collaboration applications using HTTP
US9245047B2 (en) * 2010-12-10 2016-01-26 Wyse Technology L.L.C. Methods and systems for facilitating a remote desktop session utilizing a remote desktop client common interface
CN102387206A (en) * 2011-10-20 2012-03-21 镇江睿泰信息科技有限公司 Synthesis method and system of concurrent request of Web service

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104917833A (en) * 2015-06-08 2015-09-16 北京集奥聚合网络技术有限公司 Asynchronous information processing method based on NIO request

Also Published As

Publication number Publication date
CN108055311A (en) 2018-05-18

Similar Documents

Publication Publication Date Title
CN108055311B (en) HTTP asynchronous request method, device, server, terminal and storage medium
CN108270732B (en) A kind of Streaming Media processing method and system
CN109547511B (en) WEB message real-time pushing method, server, client and system
US9392081B2 (en) Method and device for sending requests
CN108702486B (en) Low-delay audio and video transmission method and device and computer readable storage medium
CN110471749B (en) Task processing method, device, computer readable storage medium and computer equipment
WO2013185655A1 (en) Method and device for distributing mobile attendant call
WO2017185615A1 (en) Method for determining service status of service processing device and scheduling device
WO2019047568A1 (en) User call processing method, apparatus, computer device, and storage medium
CN112286688B (en) Memory management and use method, device, equipment and medium
CN106034141B (en) Message treatment method, resource acquiring method, server and terminal device
CN109947081B (en) Internet vehicle control method and device
CN106612263B (en) Method and equipment for processing application access request
CN108429703B (en) DHCP client-side online method and device
CN110333916A (en) Request message processing method, device, computer system and readable storage medium storing program for executing
CN111404842B (en) Data transmission method, device and computer storage medium
WO2019201111A1 (en) Information processing method, apparatus and device, and computer-readable storage medium
CN109831467B (en) Data transmission method, equipment and system
CN109088907B (en) File transfer method and device
CN115134422A (en) Service processing method, video network terminal, master control device, electronic device and medium
CN105912477B (en) A kind of method, apparatus and system that catalogue is read
CN106899652B (en) Method and device for pushing service processing result
CN114363204A (en) Request monitoring method, network device and storage medium
CN114416275A (en) Method and system for synchronizing virtual machine states by multiple management clients
US20180063005A1 (en) Non-blocking request 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