Movatterモバイル変換


[0]ホーム

URL:


CN107454139A - A kind of method, terminal and computer-readable recording medium for realizing persistence connection - Google Patents

A kind of method, terminal and computer-readable recording medium for realizing persistence connection
Download PDF

Info

Publication number
CN107454139A
CN107454139ACN201710500685.XACN201710500685ACN107454139ACN 107454139 ACN107454139 ACN 107454139ACN 201710500685 ACN201710500685 ACN 201710500685ACN 107454139 ACN107454139 ACN 107454139A
Authority
CN
China
Prior art keywords
http transaction
http
happening
probability
transaction
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
CN201710500685.XA
Other languages
Chinese (zh)
Other versions
CN107454139B (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.)
Nanjing Baixia High Tech Industrial Park Investment Development Co Ltd
Original Assignee
Nubia 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 Nubia Technology Co LtdfiledCriticalNubia Technology Co Ltd
Priority to CN201710500685.XApriorityCriticalpatent/CN107454139B/en
Publication of CN107454139ApublicationCriticalpatent/CN107454139A/en
Application grantedgrantedCritical
Publication of CN107454139BpublicationCriticalpatent/CN107454139B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The embodiments of the invention provide a kind of method, terminal and computer-readable recording medium for realizing persistence connection, methods described includes:Obtain the probability of happening of the second HTTP transaction based on the first HTTP HTTP transaction;Judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the transmission control protocol TCP connection of the first HTTP transaction.Pass through the scheme of the embodiment of the present invention, determine whether to close TCP connections according to the probability of happening of the second HTTP transaction based on the first HTTP transaction, so as to reduce the possibility of client memory overflow, while the performance of server is also improved, that is, reached internal memory and the optimum balance of performance.

Description

A kind of method, terminal and computer-readable recording medium for realizing persistence connection
Technical field
The present invention relates to intelligent terminal technology, espespecially a kind of method for realizing persistence connection, terminal and computer-readableStorage medium.
Background technology
The Internet, applications on Mobile Market at present, almost it is all based on HTTP (HTTP, HyperTextTransfer Protocol) reliable data transfer is carried out, it is commonly used HTTP connections to be managed, to improve clientResponse speed is held, so as to lift Consumer's Experience, improving switching performance at present mainly has two ways:Parallel connection and persistence connectConnect.Wherein, parallel connection is connected by a plurality of transmission control protocol (TCP, Transmission Control Protocol) and sent outPlay concurrent HTTP request;Persistence is connected then by reusing TCP connections, to eliminate the time delay established connection and close connection.But the two has shortcoming, and parallel connection can consume many memory sources by a plurality of TCP connections, so as to trigger self performance to askTopic, so it is a rational value that server, which would generally set the sum of parallel connection, at present;And persistence connects through reuseTCP connections, but difficult point is if client is interior for a period of time not to have HTTP request, and the related resource of HTTP connections before is alwaysIt is not turned off, the problems such as client memory overflow can be caused.
The content of the invention
, can the invention provides a kind of method, terminal and computer for realizing persistence connection for above-mentioned technical problemStorage medium is read, internal memory and the optimum balance of performance can be reached.
In order to reach the object of the invention, the invention provides a kind of method for realizing persistence connection, including:
Obtain the probability of happening of the second HTTP transaction based on the first HTTP HTTP transaction;
Judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the transmission control of the first HTTP transactionAgreement TCP connections processed.
Optionally, this method also includes:
When the probability of happening for judging the second HTTP transaction is more than preset value, the TCP of first HTTP transaction is keptConnection is in open mode.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
The response data to first HTTP transaction from server is received, institute is obtained from the response dataState the probability of happening of the second HTTP transaction.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
Counting user carries out the number of first HTTP transaction, and counting user carries out time of second HTTP transactionNumber;
The number of first HTTP transaction is carried out according to the user of statistics and user carries out second HTTP transactionNumber calculates the probability of happening of second HTTP transaction.
Optionally, transmission times and the user's progress second that first HTTP transaction is carried out according to the user of statisticsThe probability of happening that HTTP transaction number calculates second HTTP transaction includes:
According to formulaCalculate the probability of happening of second HTTP transaction;
Wherein, P is the probability of happening of second HTTP transaction, and n is the number that user carries out second HTTP transaction,M is the number that user carries out first HTTP transaction.
The present invention is that embodiment also proposed a kind of terminal, including processor and computer-readable recording medium, the meterInstruction is stored with calculation machine readable storage medium storing program for executing, when the instruction is by the computing device, realizes any one above-mentioned realityThe method of existing persistence connection.
The embodiment of the present invention also proposed a kind of computer-readable recording medium, be stored thereon with computer program, describedFollowing steps are realized when computer program is executed by processor:
Obtain the probability of happening of the second HTTP transaction based on the first HTTP HTTP transaction;
Judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the transmission control of the first HTTP transactionAgreement TCP connections processed.
Optionally, following steps are also realized when the computer program is executed by processor:
When the probability of happening for judging the second HTTP transaction is more than preset value, the TCP of first HTTP transaction is keptConnection is in open mode.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
The response data to first HTTP transaction from server is received, institute is obtained from the response dataState the probability of happening of the second HTTP transaction.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
Counting user carries out the number of first HTTP transaction, and counting user carries out time of second HTTP transactionNumber;
The number of first HTTP transaction is carried out according to the user of statistics and user carries out second HTTP transactionNumber calculates the probability of happening of second HTTP transaction.
Technical scheme of the embodiment of the present invention includes:Obtain the 2nd HTTP based on the first HTTP HTTP transactionThe probability of happening of affairs;Judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the first HTTP transactionTransmission control protocol TCP connection.By the scheme of the embodiment of the present invention, according to the 2nd HTTP things based on the first HTTP transactionThe probability of happening of business come determine whether close TCP connections, so as to reduce the possibility of client memory overflow, while also improveThe performance of server, that is, reached internal memory and the optimum balance of performance.
Brief description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, forms the part of the application, this hairBright schematic description and description is used to explain the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the hardware configuration signal for the mobile terminal for realizing each embodiment of the present invention;
The schematic diagram for the communication system that Fig. 2 is communicated between support mobile terminal of the present invention;
Fig. 3 be the embodiment of the present invention currently without available TCP connections when HTTP transaction time delay schematic diagram;
Fig. 4 (a) is the serial connection schematic diagram of 4 HTTP transactions of the embodiment of the present invention;
Fig. 4 (b) is the persistence connection diagram of 4 HTTP transactions of the embodiment of the present invention;
Fig. 5 is the method flow diagram that the embodiment of the present invention realizes persistence connection;
Fig. 6 is the structure composition schematic diagram for the device that the embodiment of the present invention realizes persistence connection;
Fig. 7 is the structure composition schematic diagram of terminal of the embodiment of the present invention.
Embodiment
Technical scheme is described in detail below in conjunction with drawings and Examples.
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In follow-up description, the suffix using such as " module ", " part " or " unit " for representing element is onlyBe advantageous to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " part " or " unit " can mixGround uses.
Terminal can be implemented in a variety of manners.For example, the terminal described in the present invention can include such as mobile phone, flat boardComputer, notebook computer, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portableMedia player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometer etc. moveDynamic terminal, and the fixed terminal such as digital TV, desktop computer.
It will be illustrated in subsequent descriptions by taking mobile terminal as an example, it will be appreciated by those skilled in the art that except specialOutside element for moving purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, its hardware architecture diagram for a kind of mobile terminal of each embodiment of the realization present invention, the shiftingDynamic terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit103rd, A/V (audio/video) input block 104, sensor 105, display unit 106, user input unit 107, interface unit108th, the part such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1Mobile terminal structure does not form the restriction to mobile terminal, and mobile terminal can be included than illustrating more or less parts,Either combine some parts or different parts arrangement.
The all parts of mobile terminal are specifically introduced with reference to Fig. 1:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, the reception and transmission of signal, specifically, by base stationDownlink information receive after, handled to processor 110;In addition, up data are sent to base station.Generally, radio frequency unit 101Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrateFrequency unit 101 can also be communicated by radio communication with network and other equipment.Above-mentioned radio communication can use any communicationStandard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunicationsSystem), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (CodeDivision Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code DivisionMultiple Access, WCDMA), TD-SCDMA (Time Division-Synchronous CodeDivision Multiple Access, TD SDMA), FDD-LTE (Frequency DivisionDuplexing-Long Term Evolution, FDD Long Term Evolution) and TDD-LTE (Time DivisionDuplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch electricity by WiFi module 102Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 1 showsGo out WiFi module 102, but it is understood that, it is simultaneously not belonging to must be configured into for mobile terminal, completely can be according to needTo be omitted in the essential scope for do not change invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is receiving orIt is sound that the voice data stored in memory 109, which is converted into audio signal and exported,.Moreover, audio output unit 103The audio output related to the specific function that mobile terminal 100 performs can also be provided (for example, call signal receives sound, disappearedBreath receives sound etc.).Audio output unit 103 can include loudspeaker, buzzer etc..
A/V input blocks 104 are used to receive audio or video signal.A/V input blocks 104 can include graphics processor(Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition modeOr the static images or the view data of video obtained in image capture mode by image capture apparatus (such as camera) are carried outReason.Picture frame after processing may be displayed on display unit 106.Picture frame after the processing of graphics processor 1041 can be depositedStorage is transmitted in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.MikeWind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042Quiet down sound (voice data), and can be voice data by such acoustic processing.Audio (voice) data after processing canTo be converted to the form output that mobile communication base station can be sent to via radio frequency unit 101 in the case of telephone calling model.Microphone 1042 can implement various types of noises and eliminate (or suppression) algorithm to eliminate (or suppression) in reception and send soundCaused noise or interference during frequency signal.
Mobile terminal 100 also includes at least one sensor 105, such as optical sensor, motion sensor and other biographiesSensor.Specifically, optical sensor includes ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to environmentThe light and shade of light adjusts the brightness of display panel 1061, and proximity transducer can close when mobile terminal 100 is moved in one's earDisplay panel 1061 and/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (generalFor three axles) size of acceleration, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture(such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.;The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer,The other sensors such as hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Display unit 106 is used for the information for showing the information inputted by user or being supplied to user.Display unit 106 can wrapDisplay panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be usedForms such as (Organic Light-Emitting Diode, OLED) configures display panel 1061.
User input unit 107 can be used for the numeral or character information for receiving input, and produce the use with mobile terminalThe key signals input that family is set and function control is relevant.Specifically, user input unit 107 may include contact panel 1071 withAnd other input equipments 1072.Contact panel 1071, also referred to as touch-screen, collect touch operation of the user on or near it(for example user uses any suitable objects or annex such as finger, stylus on contact panel 1071 or in contact panel 1071Neighbouring operation), and corresponding attachment means are driven according to formula set in advance.Contact panel 1071 may include touch detectionTwo parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation bandThe signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by itContact coordinate is converted into, then gives processor 110, and the order sent of reception processing device 110 and can be performed.In addition, canTo realize contact panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except contact panel1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrapInclude but be not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc.One or more, do not limit herein specifically.
Further, contact panel 1071 can cover display panel 1061, detect thereon when contact panel 1071 orAfter neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thingThe type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, contact panel 1071 and display panel1061 be the part independent as two to realize the input of mobile terminal and output function, but in certain embodiments, canInput and the output function of mobile terminal are realized so that contact panel 1071 and display panel 1061 is integrated, is not done herein specificallyLimit.
Interface unit 108 is connected the interface that can pass through as at least one external device (ED) with mobile terminal 100.For example,External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothingLine FPDP, memory card port, the port for connecting the device with identification module, audio input/output (I/O) endMouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, numberIt is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be withFor transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storage software program and various data.Memory 109 can mainly include storing program areaAnd storage data field, wherein, storing program area can storage program area, application program (such as the sound needed at least one functionSound playing function, image player function etc.) etc.;Storage data field can store according to mobile phone use created data (such asVoice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, can also include non-easyThe property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the whole mobile terminal of connectionIndividual part, by running or performing the software program and/or module that are stored in memory 109, and call and be stored in storageData in device 109, the various functions and processing data of mobile terminal are performed, so as to carry out integral monitoring to mobile terminal.PlaceReason device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediatedDevice is managed, wherein, application processor mainly handles operating system, user interface and application program etc., and modem processor is mainHandle radio communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 100 can also include the power supply 111 (such as battery) to all parts power supply, it is preferred that power supply 111Can be logically contiguous by power-supply management system and processor 110, so as to realize management charging by power-supply management system, putThe function such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also will not be repeated here including bluetooth module etc..
For the ease of understanding the embodiment of the present invention, the communications network system being based on below to the mobile terminal of the present invention entersRow description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention, the communication network systemUnite as the LTE system of universal mobile communications technology, the UE that the LTE system includes communicating connection successively (User Equipment, is usedFamily equipment) 201, E-UTRAN (Evolved UMTS Terrestrial Radio Access Network, evolved UMTS landsGround wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation204。
Specifically, UE201 can be above-mentioned terminal 100, and here is omitted.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returningJourney (backhaul) (such as X2 interface) is connected with other eNodeB2022, and eNodeB2021 is connected to EPC203,ENodeB2021 can provide UE201 to EPC203 access.
EPC203 can include MME (Mobility Management Entity, mobility management entity) 2031, HSS(Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way,Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy andCharging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 andThe control node of signaling between EPC203, there is provided carrying and connection management.HSS2032 is all to manage for providing some registersSuch as the function of attaching position register (not shown) etc, and preserve some and used about service features, data rate etc.The special information in family.All customer data can be transmitted by SGW2034, and PGW2035 can provide UE 201 IPAddress is distributed and other functions, and PCRF2036 is strategy and the charging control strategic decision-making of business data flow and IP bearing resourcesPoint, it selects and provided available strategy and charging control decision-making with charge execution function unit (not shown) for strategy.
IP operation 204 can include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimediaSystem) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art it is to be understood that the present invention not onlySuitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA withAnd following new network system etc., do not limit herein.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the inventive method is proposed.
Before the method for realizing persistence connection for introducing the embodiment of the present invention, HTTP transaction is introduced first, and the present invention is realApply in example, defining a HTTP transaction includes:
If currently without available TCP connections, terminal is according to Uniform Resource Identifier (URI, UniformResource Identifier) inquiry server Internet protocol (IP, Internet Protocol) address and port numbers,TCP connection requests are sent to server according to the IP address of server and port numbers, and wait the receiving to be received from serverResponse;
After the completion of TCP connections are established, terminal to server sends HTTP request, and server is carried out after receiving HTTP requestData processing, and the response data that server returns to terminal.
If currently there is available TCP connections, terminal is connected to server based on available TCP and sends HTTP request,Server receives the data processing carried out after HTTP request, and the response data that server returns to terminal.
Fig. 3 be the embodiment of the present invention currently without available TCP connections when HTTP transaction time delay schematic diagram.Such as Fig. 3 institutesShow, in this case, the time delay of HTTP transaction includes:
(1) time delay is inquired about.Time required for the IP address and port numbers of server are inquired about according to URI.
(2) TCP connection set-up delays.I.e. terminal to server sends the time required for TCP connection requests, and waitsReceive the time received required for response from server.
(3) HTTP request time delay.I.e. terminal to server sends HTTP request, needed for internet transmissions HTTP request messageTime required for the time wanted, and server process HTTP request message.
Persistence connection refers to that TCP connections are maintained at open mode by server after HTTP transaction processing terminates, withJust existing connection is reused for following HTTP request.Open mode is stilled remain in after HTTP transaction processing terminatesTCP connections are referred to as persistence connection.Non-persistentization connection can close after each HTTP transaction terminates.Persistence connectsIt can be remained between different HTTP transactions, untill terminal or server determine to be turned off.
Fig. 4 (a) is the serial connection schematic diagram of 4 HTTP transactions;Fig. 4 (b) is that the persistence connection of 4 HTTP transactions is shownIt is intended to.As shown in figure 4, when connecting the multiple HTTP transaction of progress using persistence, the time can be lifted much.If however, persistentlyTerminal is always without new HTTP transaction in change connection procedure, then can cause the leakage of terminal related resource, and causeThe waste of server related resource.
Referring to Fig. 5, according to one embodiment of present invention, there is provided a kind of method for realizing persistence connection, including:
Step 500, the probability of happening for obtaining the second HTTP transaction based on the first HTTP HTTP transaction.BagInclude:
The response data to the first HTTP transaction from server is received, the 2nd HTTP things are obtained from response dataThe probability of happening of business.
Or counting user carries out the number of the first HTTP transaction, counting user carries out the number of the second HTTP transaction;RootUser according to statistics carries out the number of the first HTTP transaction and user carries out the second HTTP transaction number and calculates the second HTTP transactionProbability of happening.
Wherein, the transmission times of the first HTTP transaction is carried out according to the user of statistics and user carries out the second HTTP transactionThe probability of happening that number calculates second HTTP transaction includes:
According to formulaCalculate the probability of happening of second HTTP transaction;
Wherein, P is the probability of happening of the second HTTP transaction, and n is the number that user carries out the second HTTP transaction, and m is userCarry out the number of the first HTTP transaction.
Wherein, server is handled HTTP request, and obtain when receiving the HTTP request of the first HTTP transactionThe probability of happening of second HTTP transaction, the probability of happening of the second HTTP transaction is included in response data and is sent to terminal.
Server can come the number that counting user carries out the first HTTP transaction, statistics by the application such as such as hot cloud, friendly allianceUser carries out the number of the second HTTP transaction;Then the number of the first HTTP transaction is carried out according to the user of statistics and user is carried outSecond HTTP transaction number calculates the probability of happening of the second HTTP transaction.
Server can carry out the number of the first HTTP transaction in the user for obtaining statistics and user carries out the 2nd HTTP thingsThe probability of happening of the second HTTP transaction is calculated after business number in real time, when receiving the HTTP request of the first HTTP transaction, directlyObtain the probability of happening of the second HTTP transaction;
The user that server when receiving the HTTP request of the first HTTP transaction, can also obtain statistics carries out firstThe number of HTTP transaction and user carry out the second HTTP transaction number, then calculate the probability of happening of the second HTTP transaction;
Certainly, server can also use the probability of happening of other modes the second HTTP transaction of acquisition, the embodiment of the present inventionThis is not construed as limiting.
Server can add the probability of happening of the second HTTP transaction in the reserved field of response data, can also be in soundAnswering increases new field in data, the new field is used for the probability of happening for depositing the second HTTP transaction.
Wherein, terminal can carry out the first HTTP transaction by counting user when user each time carries out the first HTTP transactionNumber, when user each time carries out the second HTTP transaction, counting user carries out the number of the second HTTP transaction.
Terminal can carry out the number of the first HTTP transaction in the user for obtaining statistics and user carries out the second HTTP transactionProbability of happening and the preservation of the second HTTP transaction are calculated after number in real time, after the first HTTP transaction is completed, directly obtains secondThe probability of happening of HTTP transaction;
Terminal after the first HTTP transaction is completed, can also obtain statistics user carry out the first HTTP transaction number andUser carries out the second HTTP transaction number, then calculates the probability of happening of the second HTTP transaction;
Certainly, terminal can also use the probability of happening of other modes the second HTTP transaction of acquisition, the embodiment of the present invention pairThis is not construed as limiting.
In this step, the second HTTP transaction is carried out on the basis of the first HTTP transaction, that is to say, that firstAfter HTTP transaction terminates, user could carry out the second HTTP transaction.For example, after user carries out the first HTTP transaction, user passes throughClick on the chain on the picture shown after the first HTTP transaction terminates and fetch the second HTTP transaction of progress.By taking visual field as an example, firstHTTP transaction is that user clicks on photographic match, obtains the related data of all photographic matches, and it is big to be currently shown in photography each timeThe simple of match introduces picture;User by click on current photographic match introduce picture can check the photographic match details be situated betweenContinue, that is, carry out the second HTTP transaction.
So, a user is counted when user clicks on photographic match each time and carries out the first HTTP transaction, each timeClick introduces picture and checks that a user is counted when details are introduced carries out the second HTTP transaction.
Step 501, judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the first HTTP transactionTransmission control protocol TCP connection.
In this step, the TCP connections of the first HTTP transaction refer to carry out used TCP connections during the first HTTP transaction,The TCP connections take when can be the first HTTP transaction of TCP connections or progress to be established when carrying out the first HTTP transactionTCP connections.
Optionally, this method also includes:
When the probability of happening for judging the second HTTP transaction is more than preset value, the TCP of first HTTP transaction is keptConnection is in open mode.
In the case where counting initial situation, the initial value that can pre-set the probability of happening of the second HTTP transaction is 1, that is,Say, under initial situation, it is believed that after user carries out the first HTTP transaction, the second HTTP transaction will necessarily be carried out, so, carrying out theAfter one HTTP transaction, the TCP connections of the first HTTP transaction are kept to be in open mode.
It is of course also possible to the initial value for pre-setting the probability of happening of the second HTTP transaction is 0, that is to say, that initial feelingsUnder condition, it is believed that after user carries out the first HTTP transaction, will not necessarily carry out the second HTTP transaction, so carry out the first HTTP thingsAfter business, the TCP connections of the first HTTP transaction are closed.
As an example, the method for realizing persistence connection of the embodiment of the present invention includes:
Terminal to server sends TCP connections and establishes request;
Server returns to terminal receives response;
After the completion of TCP connections are established, TCP of the terminal based on foundation connects the HTTP that the first HTTP transaction is sent to serverRequest;
Server receives HTTP request, and HTTP request is handled, and returns to response data to terminal;Wherein, ringData are answered to include the probability of happening of the second HTTP transaction based on the first HTTP transaction;
Terminal receives response data, and the probability of happening of the second HTTP transaction is obtained from response data;Judge secondThe probability of happening of HTTP transaction is more than preset value, saves as the TCP connections for carrying out the first HTTP transaction and establishing and is in open shapeState.
Referring to Fig. 6, according to another embodiment of the present invention, there is provided a kind of device for realizing persistence connection, including:
Acquisition module, the generation for obtaining the second HTTP transaction based on the first HTTP HTTP transaction are generalRate;
Processing module, the probability of happening for judging the second HTTP transaction are less than or equal to preset value, close firstThe transmission control protocol TCP connection of HTTP transaction.
Optionally, processing module is additionally operable to:
When the probability of happening for judging the second HTTP transaction is more than preset value, the TCP of first HTTP transaction is keptConnection is in open mode.
Optionally, acquisition module is specifically used for:
The response data to first HTTP transaction from server is received, institute is obtained from the response dataState the probability of happening of the second HTTP transaction.
Optionally, acquisition module is specifically used for:
Counting user carries out the number of first HTTP transaction, and counting user carries out time of second HTTP transactionNumber;
The number of first HTTP transaction is carried out according to the user of statistics and user carries out second HTTP transactionNumber calculates the probability of happening of second HTTP transaction.
Optionally, acquisition module is specifically used for:
Counting user carries out the number of first HTTP transaction, and counting user carries out time of second HTTP transactionNumber;
According to formulaCalculate the probability of happening of second HTTP transaction;
Wherein, P is the probability of happening of second HTTP transaction, and n is the number that user carries out second HTTP transaction,M is the number that user carries out first HTTP transaction.
Referring to Fig. 7, according to still another embodiment of the invention, there is provided a kind of terminal, including processor and computer-readableStorage medium, instruction is stored with the computer-readable recording medium, when the instruction is by the computing device, realizeStep in module/unit that preceding method or aforementioned means are included.
According to still another embodiment of the invention, there is provided a kind of computer-readable recording medium, be stored thereon with computerProgram, the computer program realize following steps when being executed by processor:
Obtain the probability of happening of the second HTTP transaction based on the first HTTP HTTP transaction;
Judge that the probability of happening of the second HTTP transaction is less than or equal to preset value, close the transmission control of the first HTTP transactionAgreement TCP connections processed.
Optionally, following steps are also realized when the computer program is executed by processor:
When the probability of happening for judging the second HTTP transaction is more than preset value, the TCP of first HTTP transaction is keptConnection is in open mode.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
The response data to first HTTP transaction from server is received, institute is obtained from the response dataState the probability of happening of the second HTTP transaction.
Optionally, the probability of happening for obtaining the second HTTP transaction includes:
Counting user carries out the number of first HTTP transaction, and counting user carries out time of second HTTP transactionNumber;
The number of first HTTP transaction is carried out according to the user of statistics and user carries out second HTTP transactionNumber calculates the probability of happening of second HTTP transaction.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-rowHis property includes, so that process, method, article or device including a series of elements not only include those key elements, andAnd also include the other element being not expressly set out, or also include for this process, method, article or device institute inherentlyKey element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including thisOther identical element also be present in the process of key element, method, article or device.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment sideMethod can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many casesThe former is more preferably embodiment.Based on such understanding, technical scheme is substantially done to prior art in other wordsGoing out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage mediumIn (such as ROM/RAM, magnetic disc, CD), including some instructions to cause a station terminal (can be mobile phone, computer, serviceDevice, air conditioner, or network equipment etc.) perform method described in each embodiment of the present invention.
Embodiments of the invention are described above in conjunction with accompanying drawing, but the invention is not limited in above-mentioned specificEmbodiment, above-mentioned embodiment is only schematical, rather than restricted, one of ordinary skill in the artUnder the enlightenment of the present invention, in the case of present inventive concept and scope of the claimed protection is not departed from, it can also make a lotForm, these are belonged within the protection of the present invention.
The preferred embodiments of the present invention are these are only, are not intended to limit the scope of the invention, it is every to utilize this hairThe equivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skillsArt field, is included within the scope of the present invention.

Claims (10)

CN201710500685.XA2017-06-272017-06-27Method, terminal and computer readable storage medium for realizing persistent connectionExpired - Fee RelatedCN107454139B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201710500685.XACN107454139B (en)2017-06-272017-06-27Method, terminal and computer readable storage medium for realizing persistent connection

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201710500685.XACN107454139B (en)2017-06-272017-06-27Method, terminal and computer readable storage medium for realizing persistent connection

Publications (2)

Publication NumberPublication Date
CN107454139Atrue CN107454139A (en)2017-12-08
CN107454139B CN107454139B (en)2020-06-12

Family

ID=60487046

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201710500685.XAExpired - Fee RelatedCN107454139B (en)2017-06-272017-06-27Method, terminal and computer readable storage medium for realizing persistent connection

Country Status (1)

CountryLink
CN (1)CN107454139B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110324391A (en)*2018-03-302019-10-11武汉斗鱼网络科技有限公司A kind of barrage server connection method, client and readable storage medium storing program for executing

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101902449A (en)*2009-05-312010-12-01友益(Ux)有限公司Emulation for persistent HTTP connection between network devices
US20130007299A1 (en)*2011-07-012013-01-03Stoneware, Inc.Method and apparatus for a keep-alive push agent
CN104009938A (en)*2014-06-172014-08-27合一网络技术(北京)有限公司 Method and system for persistent connection based on routing level
US9241044B2 (en)*2013-08-282016-01-19Hola Networks, Ltd.System and method for improving internet communication by using intermediate nodes

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101902449A (en)*2009-05-312010-12-01友益(Ux)有限公司Emulation for persistent HTTP connection between network devices
US20130007299A1 (en)*2011-07-012013-01-03Stoneware, Inc.Method and apparatus for a keep-alive push agent
US9241044B2 (en)*2013-08-282016-01-19Hola Networks, Ltd.System and method for improving internet communication by using intermediate nodes
CN104009938A (en)*2014-06-172014-08-27合一网络技术(北京)有限公司 Method and system for persistent connection based on routing level

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110324391A (en)*2018-03-302019-10-11武汉斗鱼网络科技有限公司A kind of barrage server connection method, client and readable storage medium storing program for executing
CN110324391B (en)*2018-03-302022-03-25武汉斗鱼网络科技有限公司Bullet screen server connection method, client and readable storage medium

Also Published As

Publication numberPublication date
CN107454139B (en)2020-06-12

Similar Documents

PublicationPublication DateTitle
CN107133092A (en)Multi-thread synchronization processing method, terminal and computer-readable recording medium
CN107222532A (en)A kind of radio firmware upgrade method, device and computer-readable recording medium
CN107463481A (en)Data interactive method, mobile terminal and storage medium
CN107682627A (en)A kind of acquisition parameters method to set up, mobile terminal and computer-readable recording medium
CN107343083A (en)One kind lifting game experiencing method, apparatus and computer-readable recording medium
CN107566635A (en)Screen intensity method to set up, mobile terminal and computer-readable recording medium
CN107181700A (en)Control method, mobile terminal and the storage medium of application program for mobile terminal
CN106953684A (en)A kind of method for searching star, mobile terminal and computer-readable recording medium
CN106953989A (en)Incoming call reminding method and device, terminal, computer-readable recording medium
CN107707450A (en)A kind of method, apparatus and computer-readable recording medium for transmitting file
CN107181865A (en)Processing method, terminal and the computer-readable recording medium of unread short messages
CN107220050A (en)Adaptive display method, terminal and computer-readable recording medium
CN107832163A (en)A kind of buffering updating method, server and computer-readable recording medium
CN107749919A (en)A kind of application program page display method and equipment
CN107844230A (en)A kind of advertisement page method of adjustment, mobile terminal and computer-readable recording medium
CN107483804A (en)A kind of image pickup method, mobile terminal and computer-readable recording medium
CN107678625A (en)Information Sharing menu display method, mobile terminal and computer-readable recording medium
CN107506468A (en)Application program searching method, terminal, server, computer-readable recording medium
CN107172605A (en)A kind of Emmergency call method, mobile terminal and computer-readable recording medium
CN109445945A (en)Memory allocation method, mobile terminal, server and the storage medium of application program
CN107818022A (en)Application programming interfaces merging method, mobile terminal and computer-readable recording medium
CN107423065A (en)Method, mobile terminal and the computer-readable recording medium that a kind of application is attended to anything else
CN107133108A (en)Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock
CN107105058A (en)Folder transmission method and mobile terminal
CN107872571A (en)Interface requests method, interface requests response method, mobile terminal and server

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
TA01Transfer of patent application right

Effective date of registration:20200519

Address after:No. 56, Shiyang Road, Qinhuai District, Nanjing City, Jiangsu Province

Applicant after:NANJING BAIXIA HIGH-TECHNOLOGY INDUSTRY PARK INVESTMENT DEVELOPMENT Co.,Ltd.

Address before:518000 Guangdong Province, Shenzhen high tech Zone of Nanshan District City, No. 9018 North Central Avenue's innovation building A, 6-8 layer, 10-11 layer, B layer, C District 6-10 District 6 floor

Applicant before:NUBIA TECHNOLOGY Co.,Ltd.

TA01Transfer of patent application right
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20200612

Termination date:20210627

CF01Termination of patent right due to non-payment of annual fee

[8]ページ先頭

©2009-2025 Movatter.jp