CN104580392A - Method, device and equipment for retaining long connection - Google Patents

Method, device and equipment for retaining long connection Download PDF

Info

Publication number
CN104580392A
CN104580392A CN201410797794.9A CN201410797794A CN104580392A CN 104580392 A CN104580392 A CN 104580392A CN 201410797794 A CN201410797794 A CN 201410797794A CN 104580392 A CN104580392 A CN 104580392A
Authority
CN
China
Prior art keywords
request
long connection
maintenance
long
script
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
CN201410797794.9A
Other languages
Chinese (zh)
Other versions
CN104580392B (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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201410797794.9A priority Critical patent/CN104580392B/en
Publication of CN104580392A publication Critical patent/CN104580392A/en
Application granted granted Critical
Publication of CN104580392B publication Critical patent/CN104580392B/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)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention aims to provide a method, a device and equipment for retaining long connection. The method comprises the following steps: sending an HTTP access request to network equipment through an application client; receiving a long connection retaining script which is returned by the network equipment and is matched with the HTTP access request; sending a long connection retaining request to the network equipment based on the long connection retaining script, and receiving a long connection retaining result returned by the network equipment in response to the long connection retaining request. According to the method, the long connection retaining script is provided for user equipment through the network equipment, so that the user equipment can continuously send the long connection retaining request to the network equipment to retain long connection between the network equipment and the user equipment; the long connection retaining script is matched with the HTTP access request sent by the user equipment, so that the long connection retaining script can effectively guarantee the reliability of long connection retaining, and the aim of increasing the long connection reuse rate is achieved.

Description

A kind of for maintaining the long method, device and the equipment that connect
Technical field
The present invention relates to Internet technical field, particularly relating to a kind of for maintaining the long technology connected.
Background technology
The long connection of HTTP refers to connect based on TCP and sends or receive multiple HTTP request.The long connection of HTTP has multiple advantage: reduce the number of times set up and be connected with dismounting TCP, the network reduced in HTTP request process is always consuming time; Reduce the cpu busy percentage of server and terminal equipment; Reduce the network I/O expense of server and terminal equipment; Improve the speed of server process HTTP request.
Because server needs the long-time state information safeguarding long connection, the long connection of HTTP can increase the memory usage of server.Consider the long above advantage connected of HTTP, especially reduce the network that connects consuming time in advantage (in slow wireless network as in 2G, 3G, 4G, WiFi, it is always consuming time that the long connection of http can significantly reduce network), HTTP long connection has become one of main method of wireless application performance optimization at present, current each main flow Web server and browser are all supported that HTTP is long and are connected, and HTTP long connection is applied in more and more widely in wireless B/S application.Wherein, long connection multiplexing rate is defined by following formula:
The HTTP request number that the HTTP request number/user of long connection multiplexing rate=multiplexing is total
Long connection multiplexing rate depends on the HTTP request number be re-used as can be seen from the above equation, and the long connection that the HTTP request number be re-used depends primarily on server or intermediate proxy server is held time, long connection is held time longer, and the probability of HTTP request this connection multiplexing is higher.The maintenance mode of current long connection, mainly through timeout mechanism, namely controls the long time connecting maintenance by the long series of parameters such as timeout value that connect of Web server, browser, intermediate proxy server.Because the overtime relative parameters setting difference of all kinds of server and browser is comparatively large, the time-out of Web server and intermediate proxy server arrange inharmonious long connection all can be caused to be re-used or reusability lower, therefore, although long this characteristic that connects of HTTP is extensively supported by major browsers and Web server, the connection multiplexing rate in network is unsatisfactory.
In prior art, support that the method for the long connection of HTTP and lifting connection multiplexing rate mainly contains following several:
1) in current network, still HTTP1.1 agreement do not supported by some older Web server and browser, thus the long connection performance of HTTP is not supported yet under default situations, for this kind of Web server and browser, can force to make it support the long connection of HTTP by interpolation Connection:keep-alive field manual in HTTP head, namely revise HTTP header information and make it support the connection of HTTP length.
2) major part is supported to Web server and the browser of HTTP1.1 agreement, browser head when sending HTTP request is default with Connection:keep-alive field, shows to give support to the long connection of HTTP.In this case, long connection multiplexing rate depends primarily on the long maintenance situation connected.The current long maintenance connected controls mainly through the timeout mechanism of server, the parameters such as the long multiplexing main maximum number of connections by time-out time, the upper service of each long connection connected determine, therefore, connection multiplexing rate is promoted by the long join dependency parameter configuration of Optimized Service device, browser and intermediate proxy server.But, the long join dependency optimum configurations difference of different Web server and browser is larger, the time-out time of such as IE8 browser is 60 seconds, the time-out time of Chrome browser is 45 seconds, the time-out time of Apache Server defaults to 5s, due to all kinds of server, browser, the long join dependency parameter difference of intermediate proxy server is larger, the long join dependency parameter configuration of Optimized Service device and browser is individual engineering end to end, and often with user access pattern and server load condition dynamical correlation, be difficult to accomplish accurate configuration, therefore, the connection multiplexing rate of current wireless application is still undesirable.
3) the TCP connection closed request that mandatory modification client sends, forces to make it keep connecting.The method of mandatory modification TCP connection closed needs the amendment authority of client browser, but most of wireless application there is no this authority, and therefore, the feasibility of which is lower.
Summary of the invention
The object of this invention is to provide a kind of for maintaining the long method, device and the equipment that connect.
According to an aspect of the present invention, provide a kind of in a user device for maintaining the long method connected, wherein, the method comprises:
HTTP access request is sent to the network equipment by applications client;
What receive that the described network equipment returns maintains script with long connection that described HTTP access request adapts;
Maintain script based on described long connection, send to the described network equipment and longly connect the request of maintenance, and receive the described network equipment in response to described long connect that the request of maintenance returns long connection maintain result.
According to another aspect of the present invention, additionally provide a kind of assisting in the network device for maintaining the long method connected, wherein, the method comprises:
According to the HTTP access request sent by applications client from subscriber equipment received, determine that long connection theed adapt with described HTTP access request maintains script;
Access results page in response to described HTTP access request is maintained script be sent to described subscriber equipment with described long connection;
Receive the long connection maintenance request sent by applications client from described subscriber equipment, and return long connection maintenance result in response to described length connection maintenance request to described subscriber equipment, wherein, described long connection maintains and asks to generate based on the described long maintenance script that connects.
According to a further aspect of the invention, additionally provide a kind of in a user device for maintaining the long device connected, wherein, this device comprises:
For being sent the device of HTTP access request to the network equipment by applications client;
Longly the device maintaining script is connected for adapting with described HTTP access request of receiving that the described network equipment returns;
For maintaining script based on described long connection, connect to the described network equipment transmission length request of maintenance, and receive the described network equipment maintains the long connection maintenance result that request returns device in response to described length connection.
According to a further aspect of the invention, additionally provide a kind of assisting in the network device for maintaining the long device connected, wherein, this device comprises:
For according to the HTTP access request sent by applications client from subscriber equipment received, determine that the length adapted with described HTTP access request is connected the device maintaining script;
For the access results page in response to described HTTP access request is maintained with described long connection the device that script is sent to described subscriber equipment;
For receiving the long connection maintenance request sent by applications client from described subscriber equipment, and return long connection maintenance result in response to described length connection maintenance request to described subscriber equipment, wherein, described long connection maintains request based on the described long device connecting maintenance script and generate.
Compared with prior art, to be thered is provided to subscriber equipment by the network equipment in the present invention and maintain script with long connection, send length connection maintenance request to the network equipment sustainably to make subscriber equipment to be connected with the length between subscriber equipment for maintaining the network equipment, the HTTP access request sent due to long connection maintenance script and subscriber equipment adapts, therefore this length connects the reliability that maintenance script can ensure to maintain long connection effectively, thus reaches the object improving long connection multiplexing rate.
Accompanying drawing explanation
By reading the detailed description done non-limiting example done with reference to the following drawings, other features, objects and advantages of the present invention will become more obvious:
Fig. 1 illustrates the method flow diagram for maintaining long connection according to one aspect of the invention;
Fig. 2 illustrates the method flow diagram for maintaining long connection in accordance with a preferred embodiment of the present invention;
Fig. 3 illustrate according to a further aspect of the present invention for maintaining the long subscriber equipment that connects and the structural representation for maintaining the long network equipment connected;
Fig. 4 illustrate in accordance with a preferred embodiment of the present invention for maintaining the long subscriber equipment that connects and the structural representation for maintaining the long network equipment connected.
In accompanying drawing, same or analogous Reference numeral represents same or analogous parts.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
Fig. 1 illustrates the method flow diagram for maintaining long connection according to one aspect of the invention.
Method according to the present invention comprises the step S1110, step S1120 and the step S1130 that are performed by subscriber equipment, and the step S1210, step S1220 and the step S1230 that are performed by the network equipment.
Wherein, the described network equipment includes but not limited to the server group that single network server, multiple webserver form or the cloud be made up of a large amount of main frame or the webserver based on cloud computing (Cloud Computing), wherein, cloud computing is the one of Distributed Calculation, the super virtual machine be made up of a group loosely-coupled computer collection.
Wherein, described subscriber equipment includes but not limited to that any one can to carry out the electronic product of man-machine interaction with user by modes such as keyboard, mouse, remote controller, touch pad or voice-operated devices, such as, personal computer, panel computer, smart mobile phone, PDA etc.
Wherein, described subscriber equipment and the network residing for the network equipment include but not limited to the Internet, wide area network, metropolitan area network, local area network (LAN), VPN etc.
It should be noted that; described subscriber equipment, the network equipment and network are only citing; other subscriber equipment that is existing or that may occur from now on, the network equipment and networks, as being applicable to the present invention, within also should being included in scope, and are contained in this with way of reference.
With reference to Fig. 1, in step S1110, subscriber equipment sends HTTP access request by applications client to the network equipment.
Wherein, described HTTP access request comprises network of network type residing for applications client, as mobile network GPRS, WSCDMA, TD-SCDMA, LTE etc., and WIFI etc.; And applications client type, as browser type, can comprise: Safari browser, QQ browser, UC browser etc.
Wherein, described applications client refers to the terminal applies being obtained webpage by http protocol and the network equipment alternately, as browser client.
Particularly, when subscriber equipment detects that user performs page request operation in applications client, applications client type is determined, then, according to page request operation and applications client type, generate HTTP access request, subsequently this HTTP access request is sent to the network equipment.
In one example, subscriber equipment is Android intelligent, user inputs a URL and carrys out webpage corresponding to this URL of request access in the browser of this Android intelligent, when subscriber equipment detects the input operation of user, by reading the relevant parameter of this browser, determine this browser type; Then, according to the information such as URL and browser type, generate HTTP access request, then send this HTTP access request by browser to the network equipment.
In step S1210, according to the HTTP access request sent by applications client from subscriber equipment received, determine that long connection theed adapt with this HTTP access request described maintains script.
Particularly, the network equipment receives the HTTP access request sent by applications client from subscriber equipment, read the page URL in this HTTP access request and browser type, inquire about in web page library according to page URL, determine the access results page corresponding with this URL; And according to HTTP access request, network type residing when determining that subscriber equipment sends this HTTP request, subsequently, the network type residing for this subscriber equipment and browser type, determine that long connection theed adapt with this HTTP access request maintains script.
Particularly, step S1210 comprises step S1211 (not shown) and step S1212, in step S1211, determines network of network type residing for the end of described family according to described TTP access request; In step S1212, network of network type and/or client type residing for client, carry out matching inquiry in the adaptive storehouse of script, to determine that long connection theed adapt with HTTP access request maintains script.
Wherein, the adaptive storehouse of script comprises network type and/or client type with growing and is connected the corresponding relation maintaining script; As, the long connection that Safari browser is corresponding under 3G network maintains script; The long connection that QQ browser is corresponding under WIFI network maintains script.
In one example, it is Safari browser that HTTP access request comprises browser type, determine that network residing for this browser is 3G network according to the inquiry of HTTP access request, be 3G network according to Safari browser and residing network thereof, matching inquiry is carried out, to determine that long connect corresponding in 3G network with Safari browser maintains script in the adaptive storehouse of script that is local or third party device.
In the present embodiment, can for the connection performance of the time delay of different network type, discharge characteristic and different browsers type, consider time income and back-end network resource pressure, under customization heterogeneous networks, long connection of different browsers maintains script, namely the HTTP access request making length connection maintenance script and subscriber equipment send adapts, thus provides Reliable guarantee for maintaining long connection based on this length connection maintenance script.
In step S1220, the access results page in response to HTTP access request is maintained script be sent to subscriber equipment with long connection by the network equipment.
Particularly, the network equipment maintains script and merges by the access results page corresponding with URL in HTTP access request obtained from web page library and with long connection that HTTP access request adapts and feed back to subscriber equipment.
In step S1120, what the reception network equipment returned maintains script with long connection that HTTP access request adapts.
Particularly, subscriber equipment receives access results page that the network equipment returns and maintains script with long connection that HTTP access request adapts; Applications client reads and resolves this access results page, and is presented in screen.
In step S1130, subscriber equipment maintains script based on long connection, sends longly connect the request of maintenance to the network equipment, and receive the network equipment in response to described long connect that the request of maintenance returns long connection maintain result.
In step S1230, the network equipment receives the long connection maintenance request sent by applications client from subscriber equipment, and return length connection maintenance result in response to this length connection maintenance request to subscriber equipment, wherein, length connects maintenance asks to maintain script generation based on length connection.
Wherein, long connection maintains request and can be the HTTP request of asking static empty graph sheet, and it is empty result that described length connects maintenance result.
Particularly, subscriber equipment maintains script based on long connection, sends length and connects the request of maintenance, such as, can send request the HTTP request of static empty graph sheet to the network equipment to the network equipment; The network equipment receives the long connection maintenance request sent by applications client from subscriber equipment, and determine that long connection maintains result based on this length connection maintenance request, subsequently, return to subscriber equipment and long connection maintain result, such as, based on the HTTP request of the static empty graph sheet of request from subscriber equipment, can determine that long connection maintains result is empty result, returns this sky result to subscriber equipment.
In the present embodiment, because the Internet resources of asking the HTTP request of static empty graph sheet and corresponding empty result to take are very little, the request processing time of the network equipment can be reduced as far as possible, reducing the size of transmitted data on network, further providing Reliable guarantee for improving long connection multiplexing rate.
Fig. 2 illustrates the method flow diagram for maintaining long connection in accordance with a preferred embodiment of the present invention.
This preferred embodiment comprise performed by subscriber equipment step S2110, step S2120 and step S2131, step S2132 and step S2133, and the step S2210, step S2220, step S2231 and the step S2232 that are performed by the network equipment.
Wherein, step S1210, the step S1220 of step S1110, step S1120 that in step S2210, step S2220 and Fig. 1 of step S2110, step S2120 that subscriber equipment performs and network equipment execution, subscriber equipment performs and network equipment execution are same or similar, do not repeat them here.
Wherein, length connects maintenance script and comprises long connection maintenance duration and long connection request transmission frequency.
In step S2131, subscriber equipment maintains script based on long connection, generates length and connects the request of maintenance; In step S2132, maintain in duration in long connection, send length to the network equipment constantly with long connection request transmission frequency and connect the request of maintenance; In step S2231, the network equipment maintains in duration in long connection, receives the long of subscriber equipment transmission constantly connect the request of maintenance with long connection request transmission frequency; In step S2232, connect in response to long the request of maintenance, return to subscriber equipment constantly and long connection maintain result; In step S2133, receive the network equipment constantly and maintain the long connection maintenance result asking to return in response to length connection.
Particularly, long connection maintains script and comprises and longly connect the script information maintaining duration and long connection request transmission frequency and ask static empty graph sheet, subscriber equipment maintains script based on this long connection, generating to comprise asks the length of static empty graph sheet to connect the request of maintenance, and this length connection maintenance request sent with long connection request transmission frequency constantly in long connection in maintenance duration; Subsequently, subscriber equipment maintained in duration in this long connection, sent request the HTTP request of static empty graph sheet with this long connection request transmission frequency constantly to the network equipment; The network equipment maintains in duration in this long connection, receives the HTTP request of the static empty graph sheet of request that subscriber equipment sends with this long connection request transmission frequency constantly; When the network equipment receives the HTTP request of asking static empty graph sheet constantly, be sky result according to the long maintenance result that connects that this HTTP request generates, and return this sky result to subscriber equipment constantly.
In one example, long connect that to maintain script be Java Script script, comprising long connect maintain that duration is 40 seconds, long connection request transmission frequency is 1 time/second and asks the script information of static empty graph sheet; Subscriber equipment connects maintenance script based on this length, generates to comprise to ask the length of static empty graph sheet to connect maintenance request, and this length connection maintenance request sent sending constantly of the frequency of once asking with kind per second in 40 seconds; Subsequently, subscriber equipment, in 40 seconds, sends request the HTTP request of static empty graph sheet with each second with sending the frequency keeps of once asking to the network equipment; The network equipment, in 40 seconds, receives the HTTP request of the static empty graph sheet of this request with each second with receiving the frequency keeps of once asking; When the network equipment receives the HTTP request of the static empty graph sheet of this request, be sky result according to the long maintenance result that connects that this HTTP request generates, and return this sky result to subscriber equipment.
In this preferred embodiment, connect that to maintain duration and long connection request transmission frequency be connection performance for the time delay of different network type, discharge characteristic and different browsers type due to long, consider that time income and back-end network resource pressure determine, therefore, carry out growing with long connection request transmission frequency the transmission and response that are connected and maintain and ask based on the long maintenance duration that connects, the long long connection multiplexing rate of raising further that connects also can be maintained and provide strong guarantee.
Fig. 3 illustrate according to a further aspect of the present invention for maintaining the long subscriber equipment that connects and the structural representation for maintaining the long network equipment connected.Comprise for maintaining the long device connected in a user device according to of the present invention: for being sent the device (hereinafter referred to as " access request dispensing device 3110 ") of HTTP access request to the network equipment by applications client; Longly the device (hereinafter referred to as " maintaining script receiving system 3120 ") maintaining script is connected for adapting with HTTP access request of receiving that the network equipment returns; For maintaining script based on long connection, connect to the network equipment transmission length request of maintenance, and receive the network equipment maintains the long connection maintenance result that request returns device (hereinafter referred to as " the first holdout device 3130 ") in response to length connection.Comprise for maintaining the long device connected according to of the present invention assisting in the network device: for according to the HTTP access request sent by applications client from subscriber equipment received, determine that the length adapted with HTTP access request is connected the device (hereinafter referred to as " access request receiving system 3210 ") maintaining script; For the access results page in response to HTTP access request is maintained with long connection the device (hereinafter referred to as " maintaining script dispensing device 3220 ") that script is sent to subscriber equipment; For receiving the long connection maintenance request sent by applications client from subscriber equipment, and return long connection maintenance result in response to length connection maintenance request to subscriber equipment, wherein, long connection maintains request based on the long device (hereinafter referred to as " the second holdout device 3230 ") connecting maintenance script and generate.
With reference to Fig. 3, first, access request dispensing device 1110 sends HTTP access request by applications client to the network equipment.
Wherein, described HTTP access request comprises network of network type residing for applications client, as mobile network GPRS, WSCDMA, TD-SCDMA, LTE etc., and WIFI etc.; And applications client type, as browser type, can comprise: Safari browser, QQ browser, UC browser etc.
Wherein, described applications client refers to the terminal applies being obtained webpage by http protocol and the network equipment alternately, as browser client.
Particularly, when subscriber equipment detects that user performs page request operation in applications client, applications client type is determined, then, according to page request operation and applications client type, generate HTTP access request, subsequently this HTTP access request is sent to the network equipment.
In one example, subscriber equipment is Android intelligent, user inputs a URL and carrys out webpage corresponding to this URL of request access in the browser of this Android intelligent, when subscriber equipment detects the input operation of user, by reading the relevant parameter of this browser, determine this browser type; Then, according to the information such as URL and browser type, generate HTTP access request, then send this HTTP access request by browser to the network equipment.
Subsequently, access request receiving system 3210, according to the HTTP access request sent by applications client from subscriber equipment received, determines that long connection theed adapt with HTTP access request maintains script.
Particularly, the network equipment receives the HTTP access request sent by applications client from subscriber equipment, read the page URL in this HTTP access request and browser type, inquire about in web page library according to page URL, determine the access results page corresponding with this URL; And according to HTTP access request, network type residing when determining that subscriber equipment sends this HTTP request, subsequently, the network type residing for this subscriber equipment and browser type, determine that long connection theed adapt with this HTTP access request maintains script.
Particularly, access request receiving system 3210 comprises the device (hereinafter referred to as " network type determining device ") for determining network of network type residing for described client according to described HTTP access request; For network of network type and/or client type residing for client, in the adaptive storehouse of script, carry out matching inquiry, to determine that the length adapted with HTTP access request is connected (hereinafter referred to as " coalignment ") that maintain script.
Wherein, the adaptive storehouse of script comprises network type and/or client type with growing and is connected the corresponding relation maintaining script; As, the long connection that Safari browser is corresponding under 3G network maintains script; The long connection that QQ browser is corresponding under WIFI network maintains script.
In one example, it is Safari browser that HTTP access request comprises browser type, network type determining device is according to this HTTP access request, inquiry determines that network residing for this browser is 3G network, coalignment is 3G network according to Safari browser and residing network thereof, matching inquiry is carried out, to determine that long connect corresponding in 3G network with Safari browser maintains script in the adaptive storehouse of script that is local or third party device.
In the present embodiment, can for the connection performance of the time delay of different network type, discharge characteristic and different browsers type, consider time income and back-end network resource pressure, under customization heterogeneous networks, long connection of different browsers maintains script, namely the HTTP access request making length connection maintenance script and subscriber equipment send adapts, thus provides Reliable guarantee for maintaining long connection based on this length connection maintenance script.
Then, maintain script dispensing device 3220 the access results page in response to HTTP access request is maintained script and is sent to subscriber equipment with growing to be connected.
Particularly, the network equipment maintains script and merges by the access results page corresponding with URL in HTTP access request obtained from web page library and with long connection that HTTP access request adapts and feed back to subscriber equipment.
Subsequently, what maintain that script receiving system 3120 receives that the network equipment returns maintains script with long connection that HTTP access request adapts.
Particularly, subscriber equipment receives access results page that the network equipment returns and maintains script with long connection that HTTP access request adapts; Applications client reads and resolves this access results page, and is presented in screen.
Then, the first holdout device 3130 maintains script based on long connection, sends longly connect the request of maintenance to the network equipment, and receive the network equipment in response to described long connect that the request of maintenance returns long connection maintain result.
Subsequently, second holdout device 3230 receives the long connection maintenance request sent by applications client from subscriber equipment, and return length connection maintenance result in response to this length connection maintenance request to subscriber equipment, wherein, length connects maintenance asks to maintain script generation based on length connection.
Wherein, long connection maintains request and can be the HTTP request of asking static empty graph sheet, and it is empty result that described length connects maintenance result.
Particularly, subscriber equipment maintains script based on long connection, sends length and connects the request of maintenance, such as, can send request the HTTP request of static empty graph sheet to the network equipment to the network equipment; The network equipment receives the long connection maintenance request sent by applications client from subscriber equipment, and determine that long connection maintains result based on this length connection maintenance request, subsequently, return to subscriber equipment and long connection maintain result, such as, based on the HTTP request of the static empty graph sheet of request from subscriber equipment, can determine that long connection maintains result is empty result, returns this sky result to subscriber equipment.
In the present embodiment, because the Internet resources of asking the HTTP request of static empty graph sheet and corresponding empty result to take are very little, the request processing time of the network equipment can be reduced as far as possible, reducing the size of transmitted data on network, further providing Reliable guarantee for improving long connection multiplexing rate.
Fig. 4 illustrate in accordance with a preferred embodiment of the present invention for maintaining the long subscriber equipment that connects and the structural representation for maintaining the long network equipment connected.
This preferred embodiment in a user device for maintaining script based on long connection, send long connection to the network equipment and maintain request, and the device receiving the long connection maintenance result that the network equipment returns in response to length connection maintenance request comprises: maintain script for connecting based on length, the connection of generation length maintains the device (hereinafter referred to as " maintenance request generating device 4131 ") of request; For maintaining in duration in long connection, send the long device (hereinafter referred to as " maintaining send-request unit 4132 ") connecting the request of maintenance to the network equipment constantly with long connection request transmission frequency; Receive the network equipment constantly and maintain the long device (hereinafter referred to as " maintaining result receiving system 4133 ") connecting maintenance result asking to return in response to long connection; In the network device for receiving the long connection maintenance request sent by applications client from subscriber equipment, and comprise in response to the device that length connection maintenance request returns length connection maintenance result to subscriber equipment: for connecting in maintenance duration in length, the length connection receiving subscriber equipment transmission with long connection request transmission frequency constantly maintains the device (hereinafter referred to as " maintenance request receiving device 4231 ") of asking; For connecting in response to long the request of maintenance, returning length to subscriber equipment constantly and connecting the device (hereinafter referred to as " maintaining result dispensing device 4232 ") maintaining result.
Wherein, length connects maintenance script and comprises long connection maintenance duration and long connection request transmission frequency.
First, maintain request generating device 4131 and maintain script based on long connection, generation is long connects the request of maintenance; Subsequently, maintain send-request unit 4132 and maintain in duration in long connection, connect to network equipment transmission is long the request of maintenance constantly with long connection request transmission frequency; Maintaining request receiving device 4231 maintains in duration in long connection, receives the long of subscriber equipment transmission constantly connect the request of maintenance with long connection request transmission frequency; Maintain result dispensing device 4232 and connect in response to long the request of maintenance, return to subscriber equipment constantly and long connection maintain result; Maintain result receiving system 4133 length that the reception network equipment returns in response to long connection maintenance request constantly and connect maintenance result.
Particularly, long connection maintains script and comprises and longly connect the script information maintaining duration and long connection request transmission frequency and ask static empty graph sheet, subscriber equipment maintains script based on this long connection, generating to comprise asks the length of static empty graph sheet to connect the request of maintenance, and this length connection maintenance request sent with long connection request transmission frequency constantly in long connection in maintenance duration; Subsequently, subscriber equipment maintained in duration in this long connection, sent request the HTTP request of static empty graph sheet with this long connection request transmission frequency constantly to the network equipment; The network equipment maintains in duration in this long connection, receives the HTTP request of the static empty graph sheet of request that subscriber equipment sends with this long connection request transmission frequency constantly; When the network equipment receives the HTTP request of asking static empty graph sheet constantly, be sky result according to the long maintenance result that connects that this HTTP request generates, and return this sky result to subscriber equipment constantly.
In one example, long connect that to maintain script be Java Script script, comprising long connect maintain that duration is 40 seconds, long connection request transmission frequency is 1 time/second and asks the script information of static empty graph sheet; Subscriber equipment connects maintenance script based on this length, generates to comprise to ask the length of static empty graph sheet to connect maintenance request, and this length connection maintenance request sent sending constantly of the frequency of once asking with kind per second in 40 seconds; Subsequently, subscriber equipment, in 40 seconds, sends request the HTTP request of static empty graph sheet with each second with sending the frequency keeps of once asking to the network equipment; The network equipment, in 40 seconds, receives the HTTP request of the static empty graph sheet of this request with each second with receiving the frequency keeps of once asking; When the network equipment receives the HTTP request of the static empty graph sheet of this request, be sky result according to the long maintenance result that connects that this HTTP request generates, and return this sky result to subscriber equipment.
In this preferred embodiment, connect that to maintain duration and long connection request transmission frequency be connection performance for the time delay of different network type, discharge characteristic and different browsers type due to long, consider that time income and back-end network resource pressure determine, therefore, carry out growing with long connection request transmission frequency the transmission and response that are connected and maintain and ask based on the long maintenance duration that connects, the long long connection multiplexing rate of raising further that connects also can be maintained and provide strong guarantee.
It should be noted that the present invention can be implemented in the assembly of software and/or software restraint, such as, application-specific integrated circuit (ASIC) (ASIC), general object computer or any other similar hardware device can be adopted to realize.In one embodiment, software program of the present invention can perform to realize step mentioned above or function by processor.Similarly, software program of the present invention (comprising relevant data structure) can be stored in computer readable recording medium storing program for performing, such as, and RAM memory, magnetic or CD-ROM driver or floppy disc and similar devices.In addition, steps more of the present invention or function can adopt hardware to realize, such as, as coordinating with processor thus performing the circuit of each step or function.
In addition, a part of the present invention can be applied to computer program, such as computer program instructions, when it is performed by computer, by the operation of this computer, can call or provide according to method of the present invention and/or technical scheme.And call the program command of method of the present invention, may be stored in fixing or moveable recording medium, and/or be transmitted by the data flow in broadcast or other signal bearing medias, and/or be stored in the working storage of the computer equipment run according to described program command.At this, comprise a device according to one embodiment of present invention, this device comprises the memory for storing computer program instructions and the processor for execution of program instructions, wherein, when this computer program instructions is performed by this processor, trigger this plant running based on the aforementioned method according to multiple embodiment of the present invention and/or technical scheme.
To those skilled in the art, obviously the invention is not restricted to the details of above-mentioned one exemplary embodiment, and when not deviating from spirit of the present invention or essential characteristic, the present invention can be realized in other specific forms.Therefore, no matter from which point, all should embodiment be regarded as exemplary, and be nonrestrictive, scope of the present invention is limited by claims instead of above-mentioned explanation, and all changes be therefore intended in the implication of the equivalency by dropping on claim and scope are included in the present invention.Any Reference numeral in claim should be considered as the claim involved by limiting.In addition, obviously " comprising " one word do not get rid of other unit or step, odd number does not get rid of plural number.Multiple unit of stating in system claims or device also can be realized by software or hardware by a unit or device.First, second word such as grade is used for representing title, and does not represent any specific order.

Claims (18)

1., in a user device for maintaining the long method connected, wherein, the method comprises:
HTTP access request is sent to the network equipment by applications client;
What receive that the described network equipment returns maintains script with long connection that described HTTP access request adapts;
Maintain script based on described long connection, send to the described network equipment and longly connect the request of maintenance, and receive the described network equipment in response to described long connect that the request of maintenance returns long connection maintain result.
2. method according to claim 1, wherein, described HTTP access request comprises: applications client type.
3. method according to claim 1 and 2, wherein, described long connection maintenance script comprises long connection and maintains duration and long connection request transmission frequency;
Wherein, maintain script based on described long connection, send to the described network equipment and longly connect the request of maintenance, and receive the described network equipment in response to described long connect that the request of maintenance returns long connection maintain result, comprising:
Maintain script based on described long connection, generate described long connection and maintain request;
Maintain in duration in described long connection, send length to the described network equipment constantly with described long connection request transmission frequency and connect the request of maintenance;
Receiving the described network equipment constantly asks the length returned to connect maintenance result in response to described long connection maintenance.
4. the method according to any one of claim 1-3, wherein, the described long HTTP request connecting maintenance request and be the static empty graph sheet of request, it is empty result that described long connection maintains result.
5. assist in the network device for maintaining the long method connected, wherein, the method comprises:
According to the HTTP access request sent by applications client from subscriber equipment received, determine that long connection theed adapt with described HTTP access request maintains script;
Access results page in response to described HTTP access request is maintained script be sent to described subscriber equipment with described long connection;
Receive the long connection maintenance request sent by applications client from described subscriber equipment, and return long connection maintenance result in response to described length connection maintenance request to described subscriber equipment, wherein, described long connection maintains and asks to generate based on the described long maintenance script that connects.
6. method according to claim 5, wherein, described HTTP access request comprises described client type;
Wherein, according to the HTTP access request from subscriber equipment received, determine that long connection theed adapt with described HTTP access request maintains script, comprising:
Network of network type residing for described client is determined according to described HTTP access request;
Network of network type and/or described client type residing for described client, carry out matching inquiry in the adaptive storehouse of script, to determine that long connection theed adapt with described HTTP access request maintains script.
7. the method according to claim 5 or 6, wherein, described long connection maintenance script comprises long connection and maintains duration and long connection request transmission frequency;
Wherein, receive the length connection maintenance request sent by applications client from described subscriber equipment, and ask to return long connection maintenance result to described subscriber equipment in response to described length connection maintenance, comprising:
Maintain in duration in described long connection, receive the long of described subscriber equipment transmission constantly with described long connection request transmission frequency and connect the request of maintenance;
Maintain request in response to described long connection, return length to described subscriber equipment constantly and connect maintenance result.
8., in a user device for maintaining the long device connected, wherein, this device comprises:
For being sent the device of HTTP access request to the network equipment by applications client;
Longly the device maintaining script is connected for adapting with described HTTP access request of receiving that the described network equipment returns;
For maintaining script based on described long connection, connect to the described network equipment transmission length request of maintenance, and receive the described network equipment maintains the long connection maintenance result that request returns device in response to described length connection.
9. method according to claim 4, wherein, described HTTP access request comprises applications client type.
10. device according to claim 8 or claim 9, wherein, described long connection maintains script and comprises and long connection maintain duration and long connection request transmission frequency;
Wherein, for maintaining script based on described long connection, connect to the described network equipment transmission length request of maintenance, and receive the described network equipment maintains the long connection maintenance result that request returns device in response to described length connection, comprising:
For maintaining script based on described long connection, generate the described long device connecting the request of maintenance;
For maintaining in duration in described long connection, send the long device connecting the request of maintenance to the described network equipment constantly with described long connection request transmission frequency;
The long device connecting maintenance result asking to return is maintained in response to described long connection for receiving the described network equipment constantly.
11. devices according to Claim 8 described in-10 any one, wherein, describedly longly connect the HTTP request of the request of maintenance for the static empty graph sheet of request, describedly longly connect that to maintain result be empty result.
Assist in the network device for maintaining the long device connected for 12. 1 kinds, wherein, this device comprises:
For according to the HTTP access request sent by applications client from subscriber equipment received, determine that the length adapted with described HTTP access request is connected the device maintaining script;
For the access results page in response to described HTTP access request is maintained with described long connection the device that script is sent to described subscriber equipment;
For receiving the long connection maintenance request sent by applications client from described subscriber equipment, and return long connection maintenance result in response to described length connection maintenance request to described subscriber equipment, wherein, described long connection maintains request based on the described long device connecting maintenance script and generate.
13. devices according to claim 12, wherein, described HTTP access request comprises described client type;
Wherein, for the HTTP access request from subscriber equipment that basis receives, determine that the length adapted with described HTTP access request is connected the device maintaining script, comprising:
For determining network of network type residing for described client according to described HTTP access request;
For network of network type and/or described client type residing for described client, in the adaptive storehouse of script, carry out matching inquiry, to determine that the length adapted with described HTTP access request is connected the device maintaining script.
14. devices according to claim 12 or 13, wherein, described long connection maintains script and comprises and long connection maintain duration and long connection request transmission frequency;
Wherein, for receiving the length connection maintenance request sent by applications client from described subscriber equipment, and asking to return the long device connecting maintenance result to described subscriber equipment in response to described long connection maintenance, comprising:
For maintaining in duration in described long connection, receive the long device connecting the request of maintenance of described subscriber equipment transmission constantly with described long connection request transmission frequency;
For maintaining request in response to described long connection, return the long device connecting maintenance result to described subscriber equipment constantly.
15. 1 kinds, for maintaining the long subscriber equipment connected, comprise the device for maintaining long connection as described in any one of claim 8 to 11.
Assisting for maintaining the long network equipment connected for 16. 1 kinds, comprising assisting for maintaining the long device connected as described in any one of claim 12 to 14.
17. 1 kinds of browsers, comprise the device for maintaining long connection as described in any one of claim 8 to 11.
18. 1 kinds of browser plug-ins, comprise the device for maintaining long connection as described in any one of claim 8 to 11.
CN201410797794.9A 2014-12-18 2014-12-18 It is a kind of to be used to maintain the long method, apparatus and equipment connected Active CN104580392B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410797794.9A CN104580392B (en) 2014-12-18 2014-12-18 It is a kind of to be used to maintain the long method, apparatus and equipment connected

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410797794.9A CN104580392B (en) 2014-12-18 2014-12-18 It is a kind of to be used to maintain the long method, apparatus and equipment connected

Publications (2)

Publication Number Publication Date
CN104580392A true CN104580392A (en) 2015-04-29
CN104580392B CN104580392B (en) 2018-04-20

Family

ID=53095550

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410797794.9A Active CN104580392B (en) 2014-12-18 2014-12-18 It is a kind of to be used to maintain the long method, apparatus and equipment connected

Country Status (1)

Country Link
CN (1) CN104580392B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107395686A (en) * 2017-06-28 2017-11-24 甘棠软件***(上海)有限公司 The method, apparatus and system of the long connection of switching
CN111614752A (en) * 2020-05-19 2020-09-01 北京百度网讯科技有限公司 Method and device for data transmission
CN112000734A (en) * 2020-08-04 2020-11-27 中国建设银行股份有限公司 Big data processing method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699911A (en) * 2007-07-03 2010-04-28 卢苇 Mobile instant messaging image compression method
CN103634409A (en) * 2013-12-12 2014-03-12 中国联合网络通信集团有限公司 Method and system for realizing always-online internet application

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699911A (en) * 2007-07-03 2010-04-28 卢苇 Mobile instant messaging image compression method
CN103634409A (en) * 2013-12-12 2014-03-12 中国联合网络通信集团有限公司 Method and system for realizing always-online internet application

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107395686A (en) * 2017-06-28 2017-11-24 甘棠软件***(上海)有限公司 The method, apparatus and system of the long connection of switching
CN107395686B (en) * 2017-06-28 2018-06-05 甘棠软件***(上海)有限公司 The method, apparatus and system of the long connection of switching
CN111614752A (en) * 2020-05-19 2020-09-01 北京百度网讯科技有限公司 Method and device for data transmission
CN112000734A (en) * 2020-08-04 2020-11-27 中国建设银行股份有限公司 Big data processing method and device

Also Published As

Publication number Publication date
CN104580392B (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN102346770B (en) WebKit browser webpage content loading method and device
CN111092877B (en) Data processing method and device, electronic equipment and storage medium
US10798194B2 (en) Webpage pushing method, client, server, and system
US10516571B2 (en) Server load management
CN110750741A (en) Webpage link skipping processing method, computer device and storage medium
CN111368520A (en) Editing method and device for electronic forms
CN107517254B (en) Dynamic data request processing system and method
CN107766509B (en) Method and device for static backup of webpage
CN104252381A (en) Method and equipment for scheduling ETL (Extraction-Transform-Loading) task
CN102082800A (en) User request processing method and server
CN104580392A (en) Method, device and equipment for retaining long connection
CN111212126B (en) Data transmission method, device, equipment and medium of block chain network
US20220413965A1 (en) Data recovery method, apparatus and device, and readable storage medium
CN103888512A (en) Method and device for downloading resources
EP3582116A1 (en) Webpage loading method, webpage loading system, and server
CN103731493A (en) Page transmission method, device and system
CN103582012A (en) Data distribution method and device
US20140026140A1 (en) Method and apparatus for optimizing download operations
CN110737856A (en) page acquisition method, device and system
CN102882988A (en) Method, device and equipment for acquiring address information of resource information
CN104539724A (en) Information processing method and system
CN103581878A (en) Method and equipment for acquiring target resources in mobile equipment
CN113094395B (en) Data query method, computer device and storage medium
CN101237301A (en) Dynamic data compression technology
CN103491393A (en) Video service processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant