CN108055311A - HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium - Google Patents

HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium Download PDF

Info

Publication number
CN108055311A
CN108055311A CN201711288020.3A CN201711288020A CN108055311A CN 108055311 A CN108055311 A CN 108055311A CN 201711288020 A CN201711288020 A CN 201711288020A CN 108055311 A CN108055311 A CN 108055311A
Authority
CN
China
Prior art keywords
data
response results
response
request
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.)
Granted
Application number
CN201711288020.3A
Other languages
Chinese (zh)
Other versions
CN108055311B (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

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 present invention provides a kind of HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium, HTTP Asynchronous Request methods, including:Receive the HTTP request information that client is sent;According to HTTP request information, corresponding response results data are generated, are added in response queue;When receiving when transferring response results data request information of client, in preset time, through transferring the corresponding response results data transferred in the connection returning response queue of response results request of data of response results data request information to client.Pass through technical scheme, on the one hand, breach limitation of the client browser for concurrent connection number, on the other hand, it response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, in another aspect, improving the promptness that response results data are transferred, reduce server-side caused by keeping HTTP request connection for a long time and connect the excessive data interaction stress problems of number.

Description

HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium
Technical field
The present invention relates to technical field of data transmission, in particular to a kind of HTTP Asynchronous Requests method, a kind of HTTP Asynchronous Request device, a kind of server, a kind of terminal and a kind of computer readable storage medium.
Background technology
HTTP (Hyper Text Transfer Protocol), i.e. hypertext transfer protocol are a kind of Wu Zhuantai, unidirectional Agreement.One HTTP request is sent to server, and server receives to ask and handled, and beams back a sound after finishing Should, in the processing procedure of server, client and server is needed to keep this HTTP connection or asked using HTTP is asynchronous It asks, returns to HTTP Asynchronous Request response results in a manner of short poll, long poll, long connection, there are following technological deficiencies:
(1) HTTP connections can all open a port every time, the end of system in the case where multiple HTTP connections are big concurrently Mouth resource can be occupied rapidly, lead to not establish new HTTP connections;Browser generally has the limitation of concurrent request number, is answering Displayed page with formula etc. needs to be simultaneously emitted by under the application scenarios of multiple requests, it may occur that beyond the limitation of concurrent request number Request sends phenomena such as not going out and causing stuck browser, failure;Under cloud application scene, because safeguard protection can pass through network base Plinth set layer to keep for a long time connection carry out suspension reconnection processing, be easy to cause user submission complicated calculations result without Method correctly responds return.
(2) using HTTP Asynchronous Requests, HTTP Asynchronous Request response results are returned in a manner of short poll, using timing to clothes Business device submits new request to realize the loading of data, and live effect is poor, and needs constantly to establish the company to server It connects, it is larger to the pressure of server;Using HTTP Asynchronous Requests, HTTP Asynchronous Request response results are returned in a manner of long poll, In no data, blocking request is until having new data generation or request timed out just to return, and client re-establishes again afterwards Connection obtains data, Service-Port resource is occupied for a long time, when same client has multiple concurrent requests, to the pressure of server Power is larger;Using HTTP Asynchronous Requests, HTTP Asynchronous Request response results are returned to long connection mode, pass through client and service Full-duplex communication between device, but under a large amount of complications, server is difficult to bear the full-duplex communication connection of substantial amounts.
The content of the invention
It is contemplated that at least solve one of technical problem present in the prior art or correlation technique.
For this purpose, it is an object of the present invention to provide a kind of HTTP Asynchronous Requests methods.
It is another object of the present invention to provide a kind of HTTP Asynchronous Requests devices.
It is yet a further object of the present invention to provide a kind of servers.
It is yet a further object of the present invention to provide a kind of terminals.
A further object of the present invention is to provide a kind of computer readable storage medium.
To achieve these goals, the technical solution of the first aspect of the present invention provides a kind of HTTP Asynchronous Request sides Method, suitable for server-side, including:Receive the HTTP request information that client is sent;According to HTTP request information, generation is corresponding Response results data, are added in response queue;When receiving when transferring response results data request information of client, pre- If in the time, through transferring, response results data request information is corresponding to transfer the connection returning response queue of response results request of data In response results data to client.
In the technical scheme, the HTTP request information sent by receiving client is the generation of response results data Foundation is provided, by according to HTTP request information, generating corresponding response results data, being added in response queue so that After the generation of response results data, the response queue for waiting and transferring return can be quickly entered, is advantageously implemented response results data Client is returned in time, by when receiving when transferring response results data request information of client, in preset time, passing through Transfer the corresponding response knot transferred in the connection returning response queue of response results request of data of response results data request information Fruit data are to client, on the one hand, client can only keep this to transfer response results request of data simultaneously with server-side Connection, carrys out the response results data in returning response queue, breaches client, such as browser to the limit of concurrent connection number System, on the other hand, HTTP request information are separated with response results data request information is transferred, and transfer response results request of data letter Independent of HTTP request information, the suspension reconnection strategy of network layer does not interfere with to be transferred response results data request information and builds breath It is vertical to transfer the connection of response results request of data, it response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, then On the one hand, the promptness that response results data are transferred is improved, reduces and HTTP request is kept to be taken caused by connecting for a long time The excessive data interaction stress problems of business end connection number.
It should be noted that after the HTTP request information for receiving that client is sent in server-side, HTTP request information corresponds to Connection break without keeping, and when transferring response results data request information of client is received in server-side, through adjusting Take response results data request information it is corresponding transfer response results request of data connection can kept in preset time.It is default Time can be 1s-20s.
In the above-mentioned technical solutions, it is preferable that when receiving when transferring response results data request information of client, In preset time, through transferring, response results data request information is corresponding to transfer response results request of data connection returning response team Response results data in row to client, including:When receiving when transferring response results data request information of client, if There are response results data in response queue, then immediately through transferring in the connection returning response queue of response results request of data extremely Few response results data remove at least one response results data in response queue and cut off this to client Transfer the connection of response results request of data.
In the technical scheme, by receiving when transferring response results data request information of client, if rung It answers there are response results data in queue, then immediately through transferring in the connection returning response queue of response results request of data at least One response results data improves the promptness that response results data are transferred, by being removed in response queue to client The response results data of return are transferred, the repetition for advantageously reducing response results data is transferred, and saves the money of server-side Source space occupies, and transfers the connection of response results request of data by cutting off this after returning response result data is transferred, reduces Keep for a long time client be connected with server-side caused by the excessive data interaction stress problems of server-side connection number, promoted The fluency of HTTP Asynchronous Request data interactions under the scenes such as cloud application.
It should be noted that when transferring response results data request information of client, returning response can received A response results data in queue, which just disconnect, transfers the connection of response results request of data, can also allow and transfer response results number It is connected according to request and keeps certain time, the response results data in returning response queue as much as possible can also allow and transfer sound Result data request connection is answered to be always maintained at, after all response results data in response queue are all returned, disconnect and adjusting Response results request of data is taken to connect.
In any of the above-described technical solution, it is preferable that when the response results request of data of transferring for receiving client is believed During breath, in preset time, through transfer response results data request information it is corresponding transfer response results request of data connection return The response results data in response queue are returned to client, including:When receive client transfers response results request of data During information, if waiting there is no response results data in response queue and starting timing;If it is less than or equal in timing duration During preset time, response results data are added in response queue, then are rung immediately through transferring the connection of response results request of data and returning Result data is answered to client, and removes response results data in response queue and cuts off this and transfer response results data Request connection and termination timing;If when timing duration is equal to or more than preset time, response results are not added in response queue Data then cut off this and transfer the connection of response results request of data and terminate timing immediately.
In the technical scheme, by receiving when transferring response results data request information of client, if response It there is no response results data in queue, then waits and starts timing, keep transferring the connection of response results request of data at this time, such as Fruit has response results data to be added to response queue in preset time, then immediately through transferring the connection of response results request of data Returning response result data is conducive to further improve the promptness that response results data are transferred, reduces data to client Interaction pressure, the response results data of return are transferred by being removed in response queue, advantageously reduce response results The repetition of data is transferred, and the resource space for saving server-side occupies, by cutting off this after returning response result data is transferred Transfer response results request of data connection, reduce keep for a long time client be connected with server-side caused by server-side connection The excessive data interaction stress problems of number improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application, It if in preset time, does not respond to result data and is added to response queue, then cut off this immediately and transfer response results number According to request connect, reduce keep for a long time client be connected with server-side caused by server-side connect number it is excessive data friendship Mutual stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application.
The technical solution of the second aspect of the present invention proposes a kind of HTTP Asynchronous Requests method, suitable for client, bag It includes:HTTP request information is sent to server-side, and adds in HTTP request information into default request pond;According in default request pond HTTP request information quantity, serial send transfers response results data request information to server-side, and keeps transferring response Result data request connection, for server-side returning response result data;The response results data that reception server-side returns, and The corresponding HTTP request information of response results data is removed in default request pond.
In the technical scheme, by sending HTTP request information to server-side, and HTTP request information is added in default It asks in pond, realizes the record statistics to total HTTP request information, advantageously reduce the omission for transferring response results data, By the way that according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to clothes Business end, and keep transferring the connection of response results request of data, be conducive to server-side and connected by transferring response results request of data, Returning response result data, the response results data returned by receiving server-side, and remove response knot in default request pond The corresponding HTTP request information of fruit data advantageously reduces repetition initiation and transfers response results data request information, saves client The resource space at end occupies, on the one hand, client only can be kept for one simultaneously with server-side and transfer response results request of data Connection, carrys out the response results data in returning response queue, breaches client, such as browser to the limit of concurrent connection number System, on the other hand, HTTP request information are separated with response results data request information is transferred, and transfer response results request of data letter Independent of HTTP request information, the suspension reconnection strategy of network layer does not interfere with to be transferred response results data request information and builds breath It is vertical to transfer the connection of response results request of data, it response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, then On the one hand, the promptness that response results data are transferred is improved, reduces and HTTP request is kept to be taken caused by connecting for a long time The excessive data interaction stress problems of business end connection number.
It should be noted that default request pond in client, can serially be sent in default request pond one by one The quantity of HTTP request information transfer response results data request information.
In the above-mentioned technical solutions, it is preferable that the response results data of server-side return are being received, and in default request pond After the corresponding HTTP request information of middle removal response results data, further include:Judge to whether there is HTTP in default request pond Solicited message;If it is determined that there is no HTTP request information in default request pond, then cut off and all transfer response results request of data Connection;If it is determined that then continue the HTTP request information in default request pond there are HTTP request information in default request pond Quantity, serial send transfers response results data request information to server-side, and keeps transferring response results request of data company It connects, for server-side returning response result data.
In the technical scheme, by judging to preset in request pond with the presence or absence of HTTP request information, default ask is being judged It asks in pond there is no during HTTP request information, cutting off all response results request of data of transferring to connect, reduces and keep for a long time The excessive data interaction stress problems of server-side connection number, improve the fields such as cloud application caused by client is connected with server-side The fluency of HTTP Asynchronous Request data interactions under scape, by default request pond is judged there are during HTTP request information, Continue according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to clothes Business end, and keep transferring the connection of response results request of data, for server-side returning response result data, realize response results Data are persistently transferred, and are managed all HTTP request information concentratedly in default request pond, are initiated to transfer response results data on demand Solicited message, ensured transfer returning response result data in real time while, and reduce excessive poll and long continue to connect The waste to server-side resource is connect, improves whole response speed, is conducive to be promoted the service ability of server-side in cloud application And performance.
The technical solution of the third aspect of the present invention proposes a kind of HTTP Asynchronous Requests device, suitable for server-side, bag It includes:Receiving unit, for receiving the HTTP request information of client transmission;Generation unit, for according to HTTP request information, life Into corresponding response results data, it is added in response queue;Returning unit, for being tied when the response of transferring for receiving client During fruit data request information, in preset time, through transferring, response results data request information is corresponding to transfer response results number According to the response results data in request connection returning response queue to client.
In the technical scheme, the HTTP request information sent by receiving client is the generation of response results data Foundation is provided, by according to HTTP request information, generating corresponding response results data, being added in response queue so that After the generation of response results data, the response queue for waiting and transferring return can be quickly entered, is advantageously implemented response results data Client is returned in time, by when receiving when transferring response results data request information of client, in preset time, passing through Transfer the corresponding response knot transferred in the connection returning response queue of response results request of data of response results data request information Fruit data are to client, on the one hand, client can only keep this to transfer response results request of data simultaneously with server-side Connection, carrys out the response results data in returning response queue, breaches client, such as browser to the limit of concurrent connection number System, on the other hand, HTTP request information are separated with response results data request information is transferred, and transfer response results request of data letter Independent of HTTP request information, the suspension reconnection strategy of network layer does not interfere with to be transferred response results data request information and builds breath It is vertical to transfer the connection of response results request of data, it response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, then On the one hand, the promptness that response results data are transferred is improved, reduces and HTTP request is kept to be taken caused by connecting for a long time The excessive data interaction stress problems of business end connection number.
It should be noted that after the HTTP request information for receiving that client is sent in server-side, HTTP request information corresponds to Connection break without keeping, and when transferring response results data request information of client is received in server-side, through adjusting Take response results data request information it is corresponding transfer response results request of data connection can kept in preset time.It is default Time can be 1s-20s.
In the above-mentioned technical solutions, it is preferable that returning unit is additionally operable to:When receive client transfers response results number During according to solicited message, if being returned immediately through transferring the connection of response results request of data there are response results data in response queue At least one response results data in response queue are returned to client, and at least one response results are removed in response queue Data and cut off this transfer response results request of data connection.
In the technical scheme, by receiving when transferring response results data request information of client, if rung It answers there are response results data in queue, then immediately through transferring in the connection returning response queue of response results request of data at least One response results data improves the promptness that response results data are transferred, by being removed in response queue to client The response results data of return are transferred, the repetition for advantageously reducing response results data is transferred, and saves the money of server-side Source space occupies, and transfers the connection of response results request of data by cutting off this after returning response result data is transferred, reduces Keep for a long time client be connected with server-side caused by the excessive data interaction stress problems of server-side connection number, promoted The fluency of HTTP Asynchronous Request data interactions under the scenes such as cloud application.
It should be noted that when transferring response results data request information of client, returning response can received A response results data in queue, which just disconnect, transfers the connection of response results request of data, can also allow and transfer response results number It is connected according to request and keeps certain time, the response results data in returning response queue as much as possible can also allow and transfer sound Result data request connection is answered to be always maintained at, after all response results data in response queue are all returned, disconnect and adjusting Response results request of data is taken to connect.
In any of the above-described technical solution, it is preferable that further include:Start unit, for when the tune for receiving client When taking response results data request information, if waiting there is no response results data in response queue and starting timing;It returns Unit is additionally operable to:If when timing duration is less than or equal to preset time, response results data are added in response queue, then immediately Returning response result data is connected to client through transferring response results request of data, and response results are removed in response queue Data and cut off this transfer response results request of data connection and terminate timing;Returning unit is additionally operable to:If in timing When length is equal to or more than preset time, response results data are not added in response queue, then cut off this immediately and transfer response knot Fruit request of data connects and terminates timing.
In the technical scheme, by receiving when transferring response results data request information of client, if response It there is no response results data in queue, then waits and starts timing, keep transferring the connection of response results request of data at this time, such as Fruit has response results data to be added to response queue in preset time, then immediately through transferring the connection of response results request of data Returning response result data is conducive to further improve the promptness that response results data are transferred, reduces data to client Interaction pressure, the response results data of return are transferred by being removed in response queue, advantageously reduce response results The repetition of data is transferred, and the resource space for saving server-side occupies, by cutting off this after returning response result data is transferred Transfer response results request of data connection, reduce keep for a long time client be connected with server-side caused by server-side connection The excessive data interaction stress problems of number improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application, It if in preset time, does not respond to result data and is added to response queue, then cut off this immediately and transfer response results number According to request connect, reduce keep for a long time client be connected with server-side caused by server-side connect number it is excessive data friendship Mutual stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application.
The technical solution of the fourth aspect of the present invention proposes a kind of HTTP Asynchronous Requests device, suitable for client, bag It includes:Transmitting element for sending HTTP request information to server-side, and adds in HTTP request information into default request pond;Hair Unit is sent to be additionally operable to:The quantity of HTTP request information in default request pond, response results data are transferred in serial transmission please Information is sought to server-side, and keeps transferring the connection of response results request of data, for server-side returning response result data;It receives Unit, for receiving the response results data of server-side return, and removal response results data are corresponding in default request pond HTTP request information.
In the technical scheme, by sending HTTP request information to server-side, and HTTP request information is added in default It asks in pond, realizes the record statistics to total HTTP request information, advantageously reduce the omission for transferring response results data, By the way that according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to clothes Business end, and keep transferring the connection of response results request of data, be conducive to server-side and connected by transferring response results request of data, Returning response result data, the response results data returned by receiving server-side, and remove response knot in default request pond The corresponding HTTP request information of fruit data advantageously reduces repetition initiation and transfers response results data request information, saves client The resource space at end occupies, on the one hand, client only can be kept for one simultaneously with server-side and transfer response results request of data Connection, carrys out the response results data in returning response queue, breaches client, such as browser to the limit of concurrent connection number System, on the other hand, HTTP request information are separated with response results data request information is transferred, and transfer response results request of data letter Independent of HTTP request information, the suspension reconnection strategy of network layer does not interfere with to be transferred response results data request information and builds breath It is vertical to transfer the connection of response results request of data, it response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, then On the one hand, the promptness that response results data are transferred is improved, reduces and HTTP request is kept to be taken caused by connecting for a long time The excessive data interaction stress problems of business end connection number.
It should be noted that default request pond in client, can serially be sent in default request pond one by one The quantity of HTTP request information transfer response results data request information.
In the above-mentioned technical solutions, it is preferable that further include:Judging unit, for judging to whether there is in default request pond HTTP request information;Unit is terminated, for if it is determined that there is no HTTP request information in default request pond, then cutting off all transfer Response results request of data connects;Transmitting element is additionally operable to:If it is determined that then continue there are HTTP request information in default request pond The quantity of HTTP request information in default request pond, serial send transfer response results data request information to service End, and keep transferring the connection of response results request of data, for server-side returning response result data.
In the technical scheme, by judging to preset in request pond with the presence or absence of HTTP request information, default ask is being judged It asks in pond there is no during HTTP request information, cutting off all response results request of data of transferring to connect, reduces and keep for a long time The excessive data interaction stress problems of server-side connection number, improve the fields such as cloud application caused by client is connected with server-side The fluency of HTTP Asynchronous Request data interactions under scape, by default request pond is judged there are during HTTP request information, Continue according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to clothes Business end, and keep transferring the connection of response results request of data, for server-side returning response result data, realize response results Data are persistently transferred, and are managed all HTTP request information concentratedly in default request pond, are initiated to transfer response results data on demand Solicited message, ensured transfer returning response result data in real time while, and reduce excessive poll and long continue to connect The waste to server-side resource is connect, improves whole response speed, is conducive to be promoted the service ability of server-side in cloud application And performance.
The technical solution of the fifth aspect of the present invention proposes a kind of server, and server includes processor, and processor is used It is realized when the computer program stored in memory is performed as what the technical solution of above-mentioned the first aspect of the present invention proposed appoints The step of HTTP Asynchronous Request methods of one.
In the technical scheme, server includes processor, and processor is used to perform the computer journey stored in memory The step of HTTP Asynchronous Request methods of any one proposed such as the technical solution of above-mentioned the first aspect of the present invention are realized during sequence, Therefore the whole of the HTTP Asynchronous Request methods for any one that the technical solution of the first aspect with the invention described above proposes has Beneficial effect, details are not described herein.
The technical solution of the sixth aspect of the present invention proposes a kind of terminal, and terminal includes processor, and processor is used to hold Any one proposed such as the technical solution of above-mentioned the second aspect of the present invention is realized during the computer program stored in line storage HTTP Asynchronous Request methods the step of.
In the technical scheme, terminal includes processor, and processor is used to perform the computer program stored in memory The step of HTTP Asynchronous Request methods for any one that the technical solution of for example above-mentioned the second aspect of the present invention of Shi Shixian proposes, because The whole of the HTTP Asynchronous Request methods for any one that the technical solution of this second aspect with the invention described above proposes is beneficial Effect, details are not described herein.
The technical solution of the seventh aspect of the present invention proposes a kind of computer readable storage medium, is stored thereon with calculating Machine program realizes the technical solution proposition of the first aspect of the present invention or second aspect when computer program is executed by processor The step of HTTP Asynchronous Request methods of any one.
In the technical scheme, computer readable storage medium, is stored thereon with computer program, and computer program is located Reason device realizes that the HTTP for any one that the first aspect of the invention described above or the technical solution of second aspect propose is asynchronous when performing The step of requesting method, therefore any one of the technical solution of the first aspect with the invention described above or second aspect proposition Whole advantageous effects of HTTP Asynchronous Request methods, details are not described herein.
By above technical scheme, HTTP request information is separated with response results data request information is transferred, and transfers response For result data solicited message independent of HTTP request information, the suspension reconnection strategy of network layer, which does not interfere with, transfers response results Data request information foundation transfers response results request of data connection, when reducing suspension reconnection response results loss of data and It throws the problem of wrong, manages all HTTP request information concentratedly in default request pond, initiate to transfer response results request of data on demand Information, ensured transfer returning response result data in real time while, and reduce excessive poll and long be continuously connected with pair The waste of server-side resource improves whole response speed, is conducive to be promoted the service ability and property of server-side in cloud application Can, there is good universality.
The additional aspect and advantage of the present invention will provide in following description section, will partly become from the following description It obtains substantially or is recognized by the practice of the present invention.
Description of the drawings
The above-mentioned and/or additional aspect and advantage of the present invention will become in the description from combination accompanying drawings below to embodiment Substantially and it is readily appreciated that, wherein:
Fig. 1 shows the schematic flow diagram of HTTP Asynchronous Requests method according to an embodiment of the invention;
Fig. 2 shows the schematic flow diagram of HTTP Asynchronous Request methods according to another embodiment of the invention;
Fig. 3 shows the schematic block diagram of HTTP Asynchronous Requests device according to an embodiment of the invention;
Fig. 4 shows the schematic block diagram of HTTP Asynchronous Request devices according to another embodiment of the invention;
Fig. 5 shows client and server-side interaction signal in HTTP Asynchronous Requests according to an embodiment of the invention Figure.
Specific embodiment
It is to better understand the objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specific real Mode is applied the present invention is further described in detail.It should be noted that in the case where there is no conflict, the implementation of the application Feature in example and embodiment can be mutually combined.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also To be implemented using other different from other modes described here, therefore, protection scope of the present invention and from described below Specific embodiment limitation.
Embodiment 1
Fig. 1 shows the schematic flow diagram of HTTP Asynchronous Requests method according to an embodiment of the invention.
As shown in Figure 1, HTTP Asynchronous Requests method according to an embodiment of the invention, suitable for server-side, including:
S102 receives the HTTP request information that client is sent;
S104 according to HTTP request information, generates corresponding response results data, is added in response queue;
S106, when receiving when transferring response results data request information of client, in preset time, through transferring sound Answer the corresponding response results data transferred in the connection returning response queue of response results request of data of result data solicited message To client.
In this embodiment, the HTTP request information sent by receiving client, carries for the generation of response results data Foundation is supplied, by according to HTTP request information, generating corresponding response results data, being added in response queue so that ring After result data is answered to generate, can quickly enter to wait and transfer the response queue of return, be advantageously implemented response results data and When return to client, by when receiving when transferring response results data request information of client, in preset time, through adjusting Take the corresponding response results transferred in the connection returning response queue of response results request of data of response results data request information Data are to client, on the one hand, client can only keep this to transfer response results request of data company simultaneously with server-side It connects, carrys out the response results data in returning response queue, breach client, such as limitation of the browser to concurrent connection number, On the other hand, HTTP request information is separated with response results data request information is transferred, and transfers response results data request information Independent of HTTP request information, the suspension reconnection strategy of network layer, which does not interfere with, transfers the foundation of response results data request information The connection of response results request of data is transferred, response results loss of data and throws the problem of wrong when reducing suspension reconnection, further Aspect improves the promptness that response results data are transferred, and reduces and HTTP request is kept to be serviced caused by connecting for a long time The excessive data interaction stress problems of end connection number.
It should be noted that after the HTTP request information for receiving that client is sent in server-side, HTTP request information corresponds to Connection break without keeping, and when transferring response results data request information of client is received in server-side, through adjusting Take response results data request information it is corresponding transfer response results request of data connection can kept in preset time.It is default Time can be 1s-20s.
In the above embodiment, it is preferable that when receiving when transferring response results data request information of client, pre- If in the time, through transferring, response results data request information is corresponding to transfer the connection returning response queue of response results request of data In response results data to client, including:When receiving when transferring response results data request information of client, if ringing It answers there are response results data in queue, then immediately through transferring in the connection returning response queue of response results request of data at least One response results data removes in response queue at least one response results data and cuts off this tune to client Response results request of data is taken to connect.
In this embodiment, by receiving when transferring response results data request information of client, if response There are response results data in queue, then immediately through transferring at least one in the connection returning response queue of response results request of data A response results data improve the promptness that response results data are transferred, by being removed in response queue to client Through being transferred the response results data of return, the repetition for advantageously reducing response results data is transferred, and saves the resource of server-side Space hold is transferred the connection of response results request of data by cutting off this after returning response result data is transferred, is reduced Keep for a long time client be connected with server-side caused by the excessive data interaction stress problems of server-side connection number, improve The fluency of HTTP Asynchronous Request data interactions under the scenes such as cloud application.
It should be noted that when transferring response results data request information of client, returning response can received A response results data in queue, which just disconnect, transfers the connection of response results request of data, can also allow and transfer response results number It is connected according to request and keeps certain time, the response results data in returning response queue as much as possible can also allow and transfer sound Result data request connection is answered to be always maintained at, after all response results data in response queue are all returned, disconnect and adjusting Response results request of data is taken to connect.
In any of the above-described embodiment, it is preferable that when receive client transfers response results data request information When, in preset time, through transferring, response results data request information is corresponding to transfer the connection return of response results request of data Response results data in response queue to client, including:When the response results request of data of transferring for receiving client is believed During breath, if waiting there is no response results data in response queue and starting timing;If it is less than or equal in timing duration pre- If during the time, response results data are added in response queue, then immediately through transferring response results request of data connection returning response Result data to client, and in response queue remove response results data and cut off this transfer response results data please It asks connection and terminates timing;If when timing duration is equal to or more than preset time, response results number is not added in response queue According to, then cut off immediately this transfer response results request of data connection and terminate timing.
In this embodiment, by receiving when transferring response results data request information of client, if response team It there is no response results data in row, then waits and starts timing, keep transferring the connection of response results request of data at this time, if In preset time, there are response results data to be added to response queue, then returned immediately through transferring the connection of response results request of data It echoes and result data is answered to be conducive to further improve the promptness that response results data are transferred, reduce data and hand over to client Mutual pressure is transferred the response results data of return by being removed in response queue, advantageously reduces response results number According to repetition transfer, save server-side resource space occupy, by cutting off this tune after returning response result data is transferred Take response results request of data connect, reduce keep for a long time client be connected with server-side caused by server-side connect number Excessive data interaction stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application, such as Fruit does not respond to result data and is added to response queue in preset time, then cuts off this immediately and transfer response results data Request connection, reduce keep for a long time client be connected with server-side caused by server-side connect the excessive data interaction of number Stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application.
Embodiment 2
Fig. 2 shows the schematic flow diagram of HTTP Asynchronous Request methods according to another embodiment of the invention.
As shown in Fig. 2, HTTP Asynchronous Requests method according to an embodiment of the invention, suitable for client, including:
S202 sends HTTP request information to server-side, and adds in HTTP request information into default request pond;
S204, the quantity of the HTTP request information in default request pond, response results data are transferred in serial transmission please Information is sought to server-side, and keeps transferring the connection of response results request of data, for server-side returning response result data;
S206 receives the response results data that server-side returns, and removes response results data pair in default request pond The HTTP request information answered.
In this embodiment, by sending HTTP request information to server-side, and add in HTTP request information and asked to default It asks in pond, realizes the record statistics to total HTTP request information, advantageously reduce the omission for transferring response results data, lead to It crosses according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to service End, and keep transferring the connection of response results request of data, be conducive to server-side and connected by transferring response results request of data, returned It echoes and answers result data, the response results data returned by receiving server-side, and remove response results in default request pond The corresponding HTTP request information of data advantageously reduces repetition initiation and transfers response results data request information, saves client Resource space occupy, on the one hand, client can with server-side simultaneously only keep one transfer response results request of data connect It connects, carrys out the response results data in returning response queue, breach client, such as limitation of the browser to concurrent connection number, On the other hand, HTTP request information is separated with response results data request information is transferred, and transfers response results data request information Independent of HTTP request information, the suspension reconnection strategy of network layer, which does not interfere with, transfers the foundation of response results data request information The connection of response results request of data is transferred, response results loss of data and throws the problem of wrong when reducing suspension reconnection, further Aspect improves the promptness that response results data are transferred, and reduces and HTTP request is kept to be serviced caused by connecting for a long time The excessive data interaction stress problems of end connection number.
It should be noted that default request pond in client, can serially be sent in default request pond one by one The quantity of HTTP request information transfer response results data request information.
In the above embodiment, it is preferable that the response results data of server-side return are being received, and in default request pond After removing the corresponding HTTP request information of response results data, further include:Judging please with the presence or absence of HTTP in default request pond Seek information;If it is determined that it then cuts off all response results request of data of transferring there is no HTTP request information in default request pond and connects It connects;If it is determined that then continue according to the HTTP request information preset in request pond there are HTTP request information in default request pond Quantity, serial send transfer response results data request information to server-side, and keep transferring the connection of response results request of data, For server-side returning response result data.
In this embodiment, by judging judging default request with the presence or absence of HTTP request information in default request pond When HTTP request information being not present in pond, cut off all response results request of data of transferring and connect, reduce and keep visitor for a long time The excessive data interaction stress problems of server-side connection number, improve the scenes such as cloud application caused by family end is connected with server-side Under HTTP Asynchronous Request data interactions fluency, by default request pond is judged there are during HTTP request information, after Continuous basis presets the quantity of the HTTP request information in request pond, and serial send transfers the extremely service of response results data request information End, and keep transferring the connection of response results request of data, for server-side returning response result data, realize response results number According to persistently transfer, manage all HTTP request information concentratedly in default request pond, initiating to transfer response results data on demand please Seek information, ensured transfer returning response result data in real time while, and reduce excessive poll and long be continuously connected with Waste to server-side resource improves whole response speed, be conducive to promoted cloud application in server-side service ability and Performance.
Embodiment 3
Fig. 3 shows the schematic block diagram of HTTP Asynchronous Requests device 300 according to an embodiment of the invention.
As shown in figure 3, HTTP Asynchronous Requests device 300 according to an embodiment of the invention, suitable for server-side, including: Receiving unit 302, for receiving the HTTP request information of client transmission;Generation unit 304, for being believed according to HTTP request Breath, generates corresponding response results data, is added in response queue;Returning unit 306, for when the tune for receiving client When taking response results data request information, in preset time, through transferring, response results data request information is corresponding to transfer sound Result data request is answered to connect the response results data in returning response queue to client.
In this embodiment, the HTTP request information sent by receiving client, carries for the generation of response results data Foundation is supplied, by according to HTTP request information, generating corresponding response results data, being added in response queue so that ring After result data is answered to generate, can quickly enter to wait and transfer the response queue of return, be advantageously implemented response results data and When return to client, by when receiving when transferring response results data request information of client, in preset time, through adjusting Take the corresponding response results transferred in the connection returning response queue of response results request of data of response results data request information Data are to client, on the one hand, client can only keep this to transfer response results request of data company simultaneously with server-side It connects, carrys out the response results data in returning response queue, breach client, such as limitation of the browser to concurrent connection number, On the other hand, HTTP request information is separated with response results data request information is transferred, and transfers response results data request information Independent of HTTP request information, the suspension reconnection strategy of network layer, which does not interfere with, transfers the foundation of response results data request information The connection of response results request of data is transferred, response results loss of data and throws the problem of wrong when reducing suspension reconnection, further Aspect improves the promptness that response results data are transferred, and reduces and HTTP request is kept to be serviced caused by connecting for a long time The excessive data interaction stress problems of end connection number.
It should be noted that after the HTTP request information for receiving that client is sent in server-side, HTTP request information corresponds to Connection break without keeping, and when transferring response results data request information of client is received in server-side, through adjusting Take response results data request information it is corresponding transfer response results request of data connection can kept in preset time.It is default Time can be 1s-20s.
In the above embodiment, it is preferable that returning unit 306 is additionally operable to:When receive client transfers response results During data request information, if there are response results data in response queue, immediately through transferring the connection of response results request of data At least one response results data in returning response queue remove at least one response knot to client in response queue Fruit data and cut off this transfer response results request of data connection.
In this embodiment, by receiving when transferring response results data request information of client, if response There are response results data in queue, then immediately through transferring at least one in the connection returning response queue of response results request of data A response results data improve the promptness that response results data are transferred, by being removed in response queue to client Through being transferred the response results data of return, the repetition for advantageously reducing response results data is transferred, and saves the resource of server-side Space hold is transferred the connection of response results request of data by cutting off this after returning response result data is transferred, is reduced Keep for a long time client be connected with server-side caused by the excessive data interaction stress problems of server-side connection number, improve The fluency of HTTP Asynchronous Request data interactions under the scenes such as cloud application.
It should be noted that when transferring response results data request information of client, returning response can received A response results data in queue, which just disconnect, transfers the connection of response results request of data, can also allow and transfer response results number It is connected according to request and keeps certain time, the response results data in returning response queue as much as possible can also allow and transfer sound Result data request connection is answered to be always maintained at, after all response results data in response queue are all returned, disconnect and adjusting Response results request of data is taken to connect.
In any of the above-described embodiment, it is preferable that further include:Start unit 308, for when the tune for receiving client When taking response results data request information, if waiting there is no response results data in response queue and starting timing;It returns Unit 306 is additionally operable to:If when timing duration is less than or equal to preset time, response results data are added in response queue, then Returning response result data is connected to client through transferring response results request of data immediately, and response is removed in response queue Result data and cut off this transfer response results request of data connection and terminate timing;Returning unit 306 is additionally operable to:If When timing duration is equal to or more than preset time, response results data are not added in response queue, then cuts off this immediately and transfers Response results request of data connects and terminates timing.
In this embodiment, by receiving when transferring response results data request information of client, if response team It there is no response results data in row, then waits and starts timing, keep transferring the connection of response results request of data at this time, if In preset time, there are response results data to be added to response queue, then returned immediately through transferring the connection of response results request of data It echoes and result data is answered to be conducive to further improve the promptness that response results data are transferred, reduce data and hand over to client Mutual pressure is transferred the response results data of return by being removed in response queue, advantageously reduces response results number According to repetition transfer, save server-side resource space occupy, by cutting off this tune after returning response result data is transferred Take response results request of data connect, reduce keep for a long time client be connected with server-side caused by server-side connect number Excessive data interaction stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application, such as Fruit does not respond to result data and is added to response queue in preset time, then cuts off this immediately and transfer response results data Request connection, reduce keep for a long time client be connected with server-side caused by server-side connect the excessive data interaction of number Stress problems improve the fluency of the HTTP Asynchronous Request data interactions under the scenes such as cloud application.
Embodiment 4
Fig. 4 shows the schematic block diagram of HTTP Asynchronous Requests device 400 according to another embodiment of the invention.
As shown in figure 4, HTTP Asynchronous Requests device 400 according to an embodiment of the invention, suitable for client, including: Transmitting element 402 for sending HTTP request information to server-side, and adds in HTTP request information into default request pond;Hair Unit 402 is sent to be additionally operable to:The quantity of HTTP request information in default request pond, serial send transfer response results data Solicited message keeps transferring the connection of response results request of data to server-side, for server-side returning response result data;It connects Unit 404 is received, for receiving the response results data of server-side return, and response results data pair are removed in default request pond The HTTP request information answered.
In this embodiment, by sending HTTP request information to server-side, and add in HTTP request information and asked to default It asks in pond, realizes the record statistics to total HTTP request information, advantageously reduce the omission for transferring response results data, lead to It crosses according to the quantity for presetting the HTTP request information in request pond, serial send transfers response results data request information to service End, and keep transferring the connection of response results request of data, be conducive to server-side and connected by transferring response results request of data, returned It echoes and answers result data, the response results data returned by receiving server-side, and remove response results in default request pond The corresponding HTTP request information of data advantageously reduces repetition initiation and transfers response results data request information, saves client Resource space occupy, on the one hand, client can with server-side simultaneously only keep one transfer response results request of data connect It connects, carrys out the response results data in returning response queue, breach client, such as limitation of the browser to concurrent connection number, On the other hand, HTTP request information is separated with response results data request information is transferred, and transfers response results data request information Independent of HTTP request information, the suspension reconnection strategy of network layer, which does not interfere with, transfers the foundation of response results data request information The connection of response results request of data is transferred, response results loss of data and throws the problem of wrong when reducing suspension reconnection, further Aspect improves the promptness that response results data are transferred, and reduces and HTTP request is kept to be serviced caused by connecting for a long time The excessive data interaction stress problems of end connection number.
It should be noted that default request pond in client, can serially be sent in default request pond one by one The quantity of HTTP request information transfer response results data request information.
In the above embodiment, it is preferable that it further includes:Judging unit 406, for judging to whether there is in default request pond HTTP request information;Unit 408 is terminated, for if it is determined that there is no HTTP request information in default request pond, then cutting off all Transfer the connection of response results request of data;Transmitting element 402 is additionally operable to:If it is determined that in default request pond, there are HTTP request letters Breath, then continue the quantity of the HTTP request information in default request pond, and serial send transfers response results request of data letter Breath keeps transferring the connection of response results request of data to server-side, for server-side returning response result data.
In this embodiment, by judging judging default request with the presence or absence of HTTP request information in default request pond When HTTP request information being not present in pond, cut off all response results request of data of transferring and connect, reduce and keep visitor for a long time The excessive data interaction stress problems of server-side connection number, improve the scenes such as cloud application caused by family end is connected with server-side Under HTTP Asynchronous Request data interactions fluency, by default request pond is judged there are during HTTP request information, after Continuous basis presets the quantity of the HTTP request information in request pond, and serial send transfers the extremely service of response results data request information End, and keep transferring the connection of response results request of data, for server-side returning response result data, realize response results number According to persistently transfer, manage all HTTP request information concentratedly in default request pond, initiating to transfer response results data on demand please Seek information, ensured transfer returning response result data in real time while, and reduce excessive poll and long be continuously connected with Waste to server-side resource improves whole response speed, be conducive to promoted cloud application in server-side service ability and Performance.
Embodiment 5
Server according to an embodiment of the invention, server include processor, and processor is deposited for performing in memory The step of the HTTP Asynchronous Request methods of any one proposed such as embodiments of the invention described above 1 is realized during the computer program of storage Suddenly.
In this embodiment, server includes processor, and processor is used to perform the computer program stored in memory The step of HTTP Asynchronous Request methods for any one that Shi Shixian such as embodiments of the invention described above 1 propose, therefore with above-mentioned Whole advantageous effects of the HTTP Asynchronous Request methods for any one that the embodiment of the present invention 1 proposes, details are not described herein.
Embodiment 6
Terminal according to an embodiment of the invention, terminal include processor, and processor is used to perform what is stored in memory The step of HTTP Asynchronous Request methods of any one proposed such as embodiments of the invention described above 2 are realized during computer program.
In this embodiment, terminal includes processor, and processor is for when performing the computer program stored in memory The step of realizing the HTTP Asynchronous Request methods of any one proposed such as embodiments of the invention described above 2, therefore with above-mentioned Whole advantageous effects of the HTTP Asynchronous Request methods for any one that the embodiment 2 of invention proposes, details are not described herein.
Embodiment 7
The computer readable storage medium proposed according to an embodiment of the invention is stored thereon with computer program, calculates It realizes that the HTTP for any one that embodiments of the invention described above 1 or embodiment 2 propose is asynchronous when machine program is executed by processor to ask The step of seeking method.
In this embodiment, computer readable storage medium, is stored thereon with computer program, and computer program is processed The step of HTTP Asynchronous Request methods for any one that embodiments of the invention described above 1 or embodiment 2 propose are realized when device performs, Therefore the whole of the HTTP Asynchronous Request methods of any one proposed with embodiments of the invention described above 1 or embodiment 2 is beneficial Effect, details are not described herein.
Embodiment 8
Fig. 5 shows client and server-side interaction signal in HTTP Asynchronous Requests according to an embodiment of the invention Figure.
As shown in figure 5, client has default request pond, receive HTTP request information and be added in default request pond, then The quantity of HTTP request information in default request pond in case of need, one by one, is serially sent out to server-side It rises and transfers response results data request information, here, be required for initiating one to server-side every time new transferring response results number According to solicited message, transfer the corresponding response results request of data of transferring of response results data request information for upper one and be connected to return It is just cut off after response results data, after receiving response results data, corresponding HTTP request is found in default request pond Information removes the HTTP request information for having received response results data from default request pond, calls at response results data Program is managed, when transferring response results request of data connection time-out, can be cut off, and re-initiates new response of transferring as needed and ties Fruit data request information.
Server-side has response queue, server-side when receiving the HTTP request information of client, give service routine into Row calculating processing, the response results data after service routine calculating processing can be added in response queue, and server-side is receiving When transferring response results data request information of client if there is response results data in response queue, is returned to response knot Fruit data if not responding to result data in response queue, wait for, until there is response results data to enter response queue, The response results data or time-out are returned, cuts off and transfers the connection of response results request of data, by client as needed again It initiates new to transfer response results data request information.
Technical scheme is described in detail above in association with attached drawing, the present invention proposes a kind of HTTP Asynchronous Request sides Method, a kind of HTTP Asynchronous Requests device, a kind of server, a kind of terminal and a kind of computer readable storage medium, pass through HTTP Solicited message is separated with response results data request information is transferred, and transferring response results data request information please independent of HTTP Seek information, the suspension reconnection strategy of network layer, which does not interfere with, to be transferred the foundation of response results data request information and transfer response results number It is connected according to request, response results loss of data and is thrown the problem of wrong when reducing suspension reconnection, preset concentrate tube in request pond All HTTP request information are managed, initiates to transfer response results data request information on demand, returning response is transferred in real time having ensured While result data, and reduce excessive poll and the long waste being continuously connected with to server-side resource, improve whole Response speed is conducive to be promoted the service ability and performance of server-side in cloud application, has good universality.
Step in the method for the present invention can be sequentially adjusted, combined, and deleted according to actual needs.
Unit in apparatus of the present invention can be combined, divided and deleted according to actual needs.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can Relevant hardware to be instructed to complete by program, which can be stored in a computer readable storage medium, storage Medium include read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), programmable read only memory (Programmable Read-only Memory, PROM), erasable programmable is read-only deposits Reservoir (Erasable Programmable Read Only Memory, EPROM), disposable programmable read-only memory (One- Time Programmable Read-Only Memory, OTPROM), the electronics formula of erasing can make carbon copies read-only memory (Electrically-Erasable Programmable Read-Only Memory, EEPROM), read-only optical disc (Compact Disc Read-Only Memory, CD-ROM) or other disk storages, magnetic disk storage, magnetic tape storage or can For carrying or storing any other computer-readable medium of data.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.Within the spirit and principles of the invention, that is made any repaiies Change, equivalent substitution, improvement etc., should all be included in the protection scope of the present invention.

Claims (13)

1. a kind of HTTP Asynchronous Requests method, suitable for server-side, which is characterized in that including:
Receive the HTTP request information that client is sent;
According to the HTTP request information, corresponding response results data are generated, are added in response queue;
When receiving when transferring response results data request information of the client, in preset time, sound is transferred through described Answer the corresponding response transferred in the response results request of data connection return response queue of result data solicited message Result data is to the client.
2. HTTP Asynchronous Requests method according to claim 1, which is characterized in that described to receive the client When transferring response results data request information, in preset time, to transfer response results data request information corresponding through described The response results data in the response results request of data connection return response queue are transferred to the client, are wrapped It includes:
When receiving when transferring response results data request information of the client, if there are the sound in the response queue Result data is answered, then transfers at least one institute in the response results request of data connection return response queue described in warp immediately Response results data are stated to the client, and at least one response results data are removed in the response queue And it cuts off and the connection of response results request of data is transferred described in this.
3. HTTP Asynchronous Requests method according to claim 1, which is characterized in that described to receive the client When transferring response results data request information, in preset time, to transfer response results data request information corresponding through described The response results data in the response results request of data connection return response queue are transferred to the client, are wrapped It includes:
When receiving when transferring response results data request information of the client, if there is no described in the response queue Response results data then wait and start timing;
If when timing duration is less than or equal to the preset time, the response results data are added in the response queue, The connection of response results request of data is then transferred described in warp immediately and returns to the response results data to the client, and described The response results data are removed in response queue and are cut off, the connection of response results request of data is transferred described in this and is terminated Timing;
If when timing duration is equal to or more than the preset time, the response results number is not added in the response queue According to, then cut off immediately transferred described in this response results request of data connection and terminate timing.
4. a kind of HTTP Asynchronous Requests method, suitable for client, which is characterized in that including:
HTTP request information is sent to server-side, and adds in the HTTP request information into default request pond;
The quantity of the HTTP request information in the default request pond, serial send transfer response results request of data Information keeps transferring the connection of response results request of data to the server-side, for the server-side returning response number of results According to;
The response results data that the server-side returns are received, and the response results are removed in the default request pond The corresponding HTTP request information of data.
5. HTTP Asynchronous Requests method according to claim 4, which is characterized in that receive the server-side return described The response results data, and it is described it is default request pond in remove the corresponding HTTP request information of the response results data Afterwards, further include:
Judge in the default request pond with the presence or absence of HTTP request information;
If it is determined that there is no the HTTP request information in the default request pond, then cut off and all described transfer response results number It is connected according to request;
If it is determined that then continue the institute in the default request pond there are the HTTP request information in the default request pond The quantity of HTTP request information is stated, serial send transfers response results data request information to the server-side, and described in holding The connection of response results request of data is transferred, for the server-side returning response result data.
6. a kind of HTTP Asynchronous Requests device, suitable for server-side, which is characterized in that including:
Receiving unit, for receiving the HTTP request information of client transmission;
Generation unit, for according to the HTTP request information, generating corresponding response results data, being added to response queue In;
Returning unit, for when receiving when transferring response results data request information of the client, in preset time, The return response queue is connected through the corresponding response results request of data of transferring of response results data request information of transferring In the response results data to the client.
7. HTTP Asynchronous Requests device according to claim 6, which is characterized in that
The returning unit is additionally operable to:When receiving when transferring response results data request information of the client, if described There are the response results data in response queue, then the connection of response results request of data is transferred described in warp immediately and returns to the sound At least one response results data in queue are answered to the client, and in the response queue remove described at least One response results data and cutting off transfer the connection of response results request of data described in this.
8. HTTP Asynchronous Requests device according to claim 6, which is characterized in that further include:
Start unit, for when receiving when transferring response results data request information of the client, if the response team There is no the response results data in row, then wait and start timing;
The returning unit is additionally operable to:If when timing duration is less than or equal to the preset time, add in the response queue Enter the response results data, then transfer the connection of response results request of data described in warp immediately and return to the response results data extremely The client, and remove in the response queue response results data and cut off and response results are transferred described in this Request of data connects and terminates timing;
The returning unit is additionally operable to:If when timing duration is equal to or more than the preset time, in the response queue not The response results data are added in, then cuts off immediately and the connection of response results request of data and termination timing is transferred described in this.
9. a kind of HTTP Asynchronous Requests device, suitable for client, which is characterized in that including:
Transmitting element for sending HTTP request information to server-side, and adds in the HTTP request information to default request pond In;
The transmitting element is additionally operable to:The quantity of the HTTP request information in the default request pond, it is serial to send Response results data request information is transferred to the server-side, and keeps transferring the connection of response results request of data, for described Server-side returning response result data;
Receiving unit, for receiving the response results data that the server-side returns, and in the default request Chi Zhongyi Except the corresponding HTTP request information of the response results data.
10. HTTP Asynchronous Requests device according to claim 9, which is characterized in that further include:
Judging unit, for judging in the default request pond with the presence or absence of HTTP request information;
Unit is terminated, for if it is determined that there is no the HTTP request information in the default request pond, then cutting off all described Transfer the connection of response results request of data;
The transmitting element is additionally operable to:If it is determined that then continue basis there are the HTTP request information in the default request pond The quantity of the HTTP request information in the default request pond, serial send transfer response results data request information to institute Server-side is stated, and the connection of response results request of data is transferred described in holding, for the server-side returning response result data.
11. a kind of server, which is characterized in that the server includes processor, and the processor is used to perform in memory The step of HTTP Asynchronous Requests method as claimed any one in claims 1 to 3 is realized during the computer program of storage.
12. a kind of terminal, which is characterized in that the terminal includes processor, and the processor stores for performing in memory Computer program when the step of realizing HTTP Asynchronous Request methods as any one of claim 4 or 5.
13. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of HTTP Asynchronous Request methods as any one of claim 1 to 5 are realized when being executed by processor.
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 true CN108055311A (en) 2018-05-18
CN108055311B 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)

Cited By (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
CN111294369A (en) * 2018-12-06 2020-06-16 阿里巴巴集团控股有限公司 Page request processing method and device and electronic equipment
CN113438284A (en) * 2021-06-09 2021-09-24 北京京东振世信息技术有限公司 Request processing method and device, electronic equipment and computer readable medium
CN114866556A (en) * 2022-05-25 2022-08-05 上海众源网络有限公司 Server resource request method and device, electronic equipment and storage medium
CN114979174A (en) * 2022-04-15 2022-08-30 四川虹美智能科技有限公司 Method for processing HTTP blocking waiting step-by-step service data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1561043A (en) * 2004-02-20 2005-01-05 中兴通讯股份有限公司 Multi-user concurrent insertion device and its method
US20080147834A1 (en) * 2006-12-19 2008-06-19 Quinn William M System and method for achieving highly scalable real-time collaboration applications using http
CN101529407A (en) * 2005-06-30 2009-09-09 湍溪系统有限责任公司 Method and apparatus for browsing network resources using an asynchronous communications protocol
CN102387206A (en) * 2011-10-20 2012-03-21 镇江睿泰信息科技有限公司 Synthesis method and system of concurrent request of Web service
CN103460670A (en) * 2010-12-10 2013-12-18 韦斯技术有限公司 Methods and systems for a remote desktop session utilizing a http handler and a remote desktop client common interface
CN104917833A (en) * 2015-06-08 2015-09-16 北京集奥聚合网络技术有限公司 Asynchronous information processing method based on NIO request

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1561043A (en) * 2004-02-20 2005-01-05 中兴通讯股份有限公司 Multi-user concurrent insertion device and its method
CN101529407A (en) * 2005-06-30 2009-09-09 湍溪系统有限责任公司 Method and apparatus for browsing network resources using an asynchronous communications protocol
US20080147834A1 (en) * 2006-12-19 2008-06-19 Quinn William M System and method for achieving highly scalable real-time collaboration applications using http
CN103460670A (en) * 2010-12-10 2013-12-18 韦斯技术有限公司 Methods and systems for a remote desktop session utilizing a http handler and a remote desktop client common interface
CN102387206A (en) * 2011-10-20 2012-03-21 镇江睿泰信息科技有限公司 Synthesis method and system of concurrent request of Web service
CN104917833A (en) * 2015-06-08 2015-09-16 北京集奥聚合网络技术有限公司 Asynchronous information processing method based on NIO request

Cited By (10)

* 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
CN111294369A (en) * 2018-12-06 2020-06-16 阿里巴巴集团控股有限公司 Page request processing method and device and electronic equipment
CN111294369B (en) * 2018-12-06 2022-06-03 阿里巴巴集团控股有限公司 Page request processing method and device and electronic equipment
CN113438284A (en) * 2021-06-09 2021-09-24 北京京东振世信息技术有限公司 Request processing method and device, electronic equipment and computer readable medium
CN113438284B (en) * 2021-06-09 2022-09-06 北京京东振世信息技术有限公司 Request processing method and device, electronic equipment and computer readable medium
CN114979174A (en) * 2022-04-15 2022-08-30 四川虹美智能科技有限公司 Method for processing HTTP blocking waiting step-by-step service data
CN114979174B (en) * 2022-04-15 2023-07-21 四川虹美智能科技有限公司 Method for processing HTTP blocking waiting step-by-step service data
CN114866556A (en) * 2022-05-25 2022-08-05 上海众源网络有限公司 Server resource request method and device, electronic equipment and storage medium
CN114866556B (en) * 2022-05-25 2024-04-19 上海众源网络有限公司 Server resource request method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN108055311B (en) 2021-03-16

Similar Documents

Publication Publication Date Title
CN108055311A (en) HTTP Asynchronous Requests method, apparatus, server, terminal and storage medium
CN110933180B (en) Communication establishment method, device, load equipment and storage medium
CN109831506A (en) File uploading method, device, terminal, server and readable storage medium storing program for executing
CN104253814B (en) A kind of Streaming Media processing method, server and browser
WO2015043413A1 (en) Method and device for sending requests
WO2013185655A1 (en) Method and device for distributing mobile attendant call
CN105898181A (en) Video conversation system and method and related equipment
CN109640113A (en) A kind of processing method and proxy server of dilatory video data
CN110856011A (en) Method for grouping live broadcast interaction, electronic equipment and storage medium
CN106034141B (en) Message treatment method, resource acquiring method, server and terminal device
CN109905629A (en) Method, apparatus, medium and the equipment of document sharing are realized when audio/video conference
CN110166346A (en) A kind of display methods and equipment of chat messages
CN105989345A (en) Method and device for discovering friends by image matching
CN105979277A (en) File transfer method and electronic equipment
CN110351569A (en) A kind of live content processing method, device, equipment and medium
WO2015096678A1 (en) Information interaction method, device and server
CN107026861A (en) A kind of plug-flow method and device
CN104967551B (en) The method and relevant device and communication system of blit interaction
CN112398754B (en) Data transmission method, device, medium, electronic equipment and network access equipment
CN108632136A (en) Patrol river data processing method and device
CN111600808A (en) Information processing method and device for instant messaging
CN113055348A (en) Cross-platform data request method and device and electronic equipment
CN109120578B (en) Method and device for realizing link connection processing
US20170185945A1 (en) Dynamic interaction pacing
CN105471699A (en) Information display method and information display device in communication

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