CN106375148A - Dynamic network heartbeat processing method in instant communication and terminal - Google Patents

Dynamic network heartbeat processing method in instant communication and terminal Download PDF

Info

Publication number
CN106375148A
CN106375148A CN201610785094.7A CN201610785094A CN106375148A CN 106375148 A CN106375148 A CN 106375148A CN 201610785094 A CN201610785094 A CN 201610785094A CN 106375148 A CN106375148 A CN 106375148A
Authority
CN
China
Prior art keywords
server
heartbeat
heart beating
terminal
period
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
CN201610785094.7A
Other languages
Chinese (zh)
Other versions
CN106375148B (en
Inventor
杨厂普
党艳平
耿继祖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing VRV Software Corp Ltd
Original Assignee
Beijing VRV Software Corp 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 VRV Software Corp Ltd filed Critical Beijing VRV Software Corp Ltd
Priority to CN201610785094.7A priority Critical patent/CN106375148B/en
Publication of CN106375148A publication Critical patent/CN106375148A/en
Application granted granted Critical
Publication of CN106375148B publication Critical patent/CN106375148B/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
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention provides a dynamic network heartbeat processing method in instant communication and a terminal. The dynamic network heartbeat processing method comprises the following steps of: sending a heartbeat data packet to a server through a dynamic detection heartbeat mode when an instant communication application program in the terminal is in an operation state and the terminal is in a dormancy/blank screen state or the instant communication application program in the terminal is in a background operation state; and sending the heartbeat data packet to the server through a fixed heartbeat mode when the instant communication application program in the terminal is in a foreground activation operation state. By means of the dynamic network heartbeat processing method in instant communication and the terminal disclosed by the invention, messages can be received in time; and thus, the flow and the energy can be effectively saved.

Description

Dynamic network heart beating processing method in instant messaging and terminal
Technical field
The present invention relates to instant messaging technical field, the dynamic network heart beating process side in more particularly, to a kind of instant messaging Method and terminal.
Background technology
Instant messaging, communicates in time, refers to a kind of business of the instant exchange message based on the Internet, also referred to as " real When communication ", referred to as im.Two people or many people is allowed to transmit word message, file in real time using network, voice and video is handed over Stream.
In the current mobile Internet swift and violent epoch increasing, mobile im class application program emerges in an endless stream, but stablizing of doing, Efficiently, the good application product of experience is few.And the difference of mobile im application program and traditional desktop im software program maximum It is that network environment is more complicated, equipment computing capability is worse, the energy is more precious.
The feature of the application program of im is exactly " timely ", and the almost all of im of this point is to use transmission control protocol The long link of (transmission control protocol, abbreviation tcp) to be realized plus heart beating.This technology point can To say the being basic technology point that timely bitcom is most difficult to, especially on the mobile apparatus, this technology point is also relate to traffic fee With, energy resource consumption.So perfect, to handle this block technology well more important.
Using tcp, prior art is because that tcp can ensure that under connected state information receiving and transmitting is complete, in time, reliable.Make With being the availability in order to detect tcp link the reason heart beating.
Existing application uses fixing eartbeat interval mostly, and fixing eartbeat interval has a following shortcoming: 1st, interval setting is excessive, when network changes it is impossible to perceive as early as possible, causes to receive message not in time;2nd, interval setting mistake Little, do useless heart beating, excessive consumed flow and the energy in the most of the time.
In consideration of it, how providing, message and effective flow and energy saved can be received in a kind of instant messaging in time Network Heartbeat processing method and terminal become the current technical issues that need to address.
Content of the invention
For solving above-mentioned technical problem, the present invention provide a kind of dynamic network heart beating processing method in instant messaging and Terminal, can detect the availability of network when network changes as early as possible, receive message in time, improve application program Experience, flow and energy resource consumption can be effectively saved in dynamic detection network heart beating, reduce the cost of use of user.
In a first aspect, the present invention provides the dynamic network heart beating processing method in a kind of instant messaging, comprising:
Instant messaging application program in the terminal is in running status and when terminal is in dormancy/black state, or When person's instant messaging application program in the terminal is in background operation state, sent out to server by dynamic instrumentation heart pattern Send heartbeat data packets;
When instant messaging application program in the terminal is in foreground activation running status, by fixing heart pattern to clothes Business device sends heartbeat data packets.
Alternatively, described dynamic instrumentation heart pattern, comprising: the action in short heart beating period, the action in heartbeat detection period With the action stablizing heart beating period.
Alternatively, the action in described short heart beating period, comprising:
When being switched to a new network, send heartbeat data packets using short heart beating to server, described short heart beating It is spaced apart default first time period;
If the number of times continuously receiving the response that described server returns is more than preset first threshold value, enter described heart beating Detection period.
Alternatively, the action in described heartbeat detection period, comprising:
When entering described heartbeat detection period, current heartbeat interval and last eartbeat interval is made to be equal to default minimum Eartbeat interval;
It is spaced using current heartbeat and send heartbeat data packets to server;
If receiving the response that described server returns, the last eartbeat interval of order is equal to current heartbeat and is spaced, then Current heartbeat interval is made to increase default second time period;
Judge current heartbeat interval whether more than or equal to default maximum eartbeat interval;
If current heartbeat interval is more than or equal to default maximum eartbeat interval, current heartbeat interval is made to be equal to the default maximum heart Jump space, then makes last eartbeat interval be equal to current heartbeat and is spaced, subsequently into stablizing heart beating period;
If current heartbeat interval is less than default maximum eartbeat interval, return is spaced using current heartbeat and sends to server The step of heartbeat data packets.
Alternatively, the action in described heartbeat detection period, also includes:
After described use current heartbeat is spaced and sends heartbeat data packets to server, if being not received by described service The response that device returns, then enter and stablize heart beating period.
Alternatively, the described action stablizing heart beating period, comprising:
The last eartbeat interval finally being detected using described heartbeat detection period sends heartbeat data packets to server;
Send heart beating in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After packet, if being not received by the response of described server return and being continuously not received by what described server returned The number of times of response is less than default Second Threshold, then the number of times being continuously not received by the response that described server returns adds 1, and Send heartbeat data packets using short heart beating to server;
After sending heartbeat data packets using short heart beating to server, if receiving the response that described server returns, Then return the described last eartbeat interval finally detecting using described heartbeat detection period and send heartbeat data to server The step of bag.
Alternatively, the described action stablizing heart beating period, also includes:
After sending heartbeat data packets using short heart beating to server, if being not received by answering of described server return Answer, then return the described number of times being continuously not received by the response that described server returns and add 1, and using short heart beating to service The step that device sends heartbeat data packets.
Alternatively, the described action stablizing heart beating period, also includes:
Send heart beating in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After packet, if being not received by the response of described server return and being continuously not received by what described server returned The number of times of response is more than default Second Threshold, then return the beginning in described short heart beating period.
Alternatively, the action of described fixing heart pattern, comprising:
The last eartbeat interval finally being detected using described dynamic instrumentation heart pattern sends beats to server According to bag.
Second aspect, the present invention provides a kind of terminal, comprising:
First sending module, is in running status for instant messaging application program in the terminal and terminal is in not During dormancy/black state, or when instant messaging application program in the terminal is in background operation state, by the dynamic instrumentation heart Hop pattern sends heartbeat data packets to server;
Second sending module, when being in foreground activation running status for instant messaging application program in the terminal, leads to Cross fixing heart pattern and send heartbeat data packets to server.
As shown from the above technical solution, the dynamic network heart beating processing method in the instant messaging of the present invention and terminal, leads to The instant messaging application program crossed in the terminal is in running status and when terminal is in dormancy/black state, or at end When instant messaging application program in end is in background operation state, heart beating is sent to server by dynamic instrumentation heart pattern Packet, when instant messaging application program in the terminal is in foreground activation running status, by fixing heart pattern to clothes Business device sends heartbeat data packets, thus, can detect when network changes the availability of network as early as possible, receives in time Message, improves the experience of application program, and flow and energy resource consumption can be effectively saved in dynamic detection network heart beating, fall The cost of use of low user.
Brief description
The flow process of the dynamic network heart beating processing method in the instant messaging that Fig. 1 provides for one embodiment of the invention is illustrated Figure;
Fig. 2 is mutual the patrolling of conversion between dynamic instrumentation heart pattern provided in an embodiment of the present invention and fixing heart pattern Collect schematic flow sheet;
Fig. 3 is the logic flow schematic diagram of the action in short heart beating period provided in an embodiment of the present invention;
Fig. 4 is the logic flow schematic diagram of the action in heartbeat detection period provided in an embodiment of the present invention;
Fig. 5 is total logic flow schematic diagram of dynamic instrumentation heart pattern provided in an embodiment of the present invention;
The structural representation of the terminal that Fig. 6 provides for one embodiment of the invention.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is carried out with clear, complete description it is clear that described embodiment only It is only a part of embodiment of the present invention, rather than whole embodiments.Based on embodiments of the invention, ordinary skill people The every other embodiment that member is obtained under the premise of not making creative work, broadly falls into the scope of protection of the invention.
In the prior art, impact tcp length link survival factor have following some:
First, network address translation (network address translation, abbreviation nat) is expired, now mobile operation The chamber of commerce connects in tcp does not have data transfer to exceed the regular hour, can this tcp of forced interruption connect, it is extremely whole that this belongs to tcp End.All without perceiving immediately, this is a major reason causing mobile im network to interrupt to tcp client and server.
2nd, DHCP (dynamic host configuration protocol, the abbreviation dhcp) rental period Expired, some ARIXTRA types occur this problem.
3rd, the change of network state, such as wifi network turns mobile network or when wifi network turns wifi network etc. Wait, network can be caused to interrupt.
Because the energy reservess of mobile device are limited, flow charging.So heartbeat detection also needs in view of this respect Factor.So the overall thought of the present invention be bonding apparatus running status dynamic instrumentation calculate eartbeat interval method come to solve work as The basic technology problem that front im application program faces.
Fig. 1 shows that the flow process of the dynamic network heart beating processing method in the instant messaging that one embodiment of the invention provides is shown It is intended to, as shown in figure 1, the dynamic network heart beating processing method in the instant messaging of the present embodiment is applied to terminal, concrete grammar As described below.
101st, instant messaging application program in the terminal is in running status and terminal is in dormancy/black state When, or when instant messaging application program in the terminal is in background operation state, by dynamic instrumentation heart pattern to clothes Business device sends heartbeat data packets.
102nd, when instant messaging application program in the terminal is in foreground activation running status, by fixing heart pattern Send heartbeat data packets to server.
In a particular application, between described dynamic instrumentation heart pattern and described fixing heart pattern, mutual conversion logic can With reference to Fig. 2.
It should be noted that, the application program in current ios system typically only exists foreground activation running status (i.e. terminal Bright screen, application program and be in foreground), so the application program in ios system only exists step above-mentioned 102.But, ios system In system, the application program with running background authority through Fructus Mali pumilae examination & approval can also use above-mentioned steps 101.
It is understood that the present embodiment methods described goes for various terminals type, as described terminal can be Mobile terminal or desktop terminal etc., benefit is bigger on a mobile platform for the present embodiment methods described, but the present embodiment is simultaneously It is not limited.
Dynamic network heart beating processing method in the instant messaging of the present embodiment, be applied to terminal, by the terminal Instant messaging application program is in running status and when terminal is in dormancy/black state, or IMU in the terminal News application program is in during background operation state and passes through dynamic instrumentation heart pattern to server transmission heartbeat data packets, in terminal In instant messaging application program beats are sent to server by fixing heart pattern when being in foreground activation running status According to bag.Thus, the availability of network can be detected when network changes as early as possible, receive message in time, improve application The experience of program, flow and energy resource consumption can be effectively saved in dynamic detection network heart beating, reduce the use of user Expense.
In a particular application, described dynamic instrumentation heart pattern, comprising: the action in short heart beating period, heartbeat detection period Action and the action stablizing heart beating period.
In a particular application, the action in described short heart beating period, may include that
When being switched to a new network, send heartbeat data packets using short heart beating to server, described short heart beating It is spaced apart default first time period;
If the number of times continuously receiving the response that described server returns is more than preset first threshold value, enter described heart beating Detection period.
In a particular application, for example, described default first time period can be preferably 30 seconds, described default first when Between section specifically can be arranged with practical situation, the present embodiment is not limited.
In a particular application, for example, described preset first threshold value can be preferably 3 times, described preset first threshold value Specifically can be arranged with practical situation, the present embodiment is not limited.
If it is understood that after sending heartbeat data packets using heart beating to server, receiving server return This heartbeat data packets corresponding reply data bag, then can determine this heart beating success.The patrolling of the action in described short heart beating period Collect flow chart and may be referred to Fig. 3, in figure:
Represent the number of times of the continuous short heart beating of success of mark with qhbsucccount, that is, above-mentioned continuously receive described server The number of times of the response returning;
Represent the maximum times of the continuous successful heart beating of mark with qhbsuccmaxcount, i.e. above-mentioned preset first threshold value, when During qhbsucccount >=qhbsuccmaxcount, proceed to heartbeat detection period.
In a particular application, the action in described heartbeat detection period, may include that
When entering described heartbeat detection period, current heartbeat interval and last eartbeat interval is made to be equal to default minimum Eartbeat interval;
It is spaced using current heartbeat and send heartbeat data packets to server;
If receiving the response that described server returns, the last eartbeat interval of order is equal to current heartbeat and is spaced, then Current heartbeat interval is made to increase default second time period;
Judge current heartbeat interval whether more than or equal to default maximum eartbeat interval;
If current heartbeat interval is more than or equal to default maximum eartbeat interval, current heartbeat interval is made to be equal to the default maximum heart Jump space, then makes last eartbeat interval be equal to current heartbeat and is spaced, subsequently into stablizing heart beating period;
If current heartbeat interval is less than default maximum eartbeat interval, return is spaced using current heartbeat and sends to server The step of heartbeat data packets.
Further, the action in described heartbeat detection period, can also include:
After described use current heartbeat is spaced and sends heartbeat data packets to server, if being not received by described service The response that device returns, then enter and stablize heart beating period.
The logical flow chart of the action in specific heartbeat detection period may be referred to Fig. 4, in figure:
Represent above-mentioned default maximum eartbeat interval with maxhbtime, if the eartbeat interval in heartbeat detection period is more than be somebody's turn to do Then eartbeat interval is set to maxhbtime to value, and proceeds to stable heart beating period;
Represent above-mentioned default minimum eartbeat interval with minhbtime, enter between heartbeat detection first time in period heart beating Every.
Represent above-mentioned current heartbeat interval, minhbtime≤curhbtime≤maxhbtime with curhbtime;
Represent that eartbeat interval increases duration, i.e. above-mentioned default second time period with hbtimestep, be a fixed value, take Value scope can be preferably 15 seconds~30 seconds, and described default second time period specifically can be arranged with practical situation, and the present embodiment is simultaneously It is not limited.
Represent last eartbeat interval with lasthbtime, go to lasthbtime after stable heart beating period as fixation Eartbeat interval.
Above variable unit is all the second, and curhbtime of success increases hbtimestep, until maximum eartbeat interval Or heart beating failure, is just successfully spaced as the eartbeat interval stablizing heart beating period with last heart beating.
It is understood that due to the progress of technology, the nat time-out of Virtual network operator may become larger.So the heart The maxhbtime jumping detection period can become larger, in units of week, in described heartbeat detection period, if there is excessively continuous The detection heart beating of preset times (can be preferably three times) all reaches maxhbtime, then maxhbtime is increased hbtimestep Second.
In a particular application, the described action stablizing heart beating period, may include that
The last eartbeat interval finally being detected using described heartbeat detection period sends heartbeat data packets to server;
Send heart beating in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After packet, if being not received by the response of described server return and being continuously not received by what described server returned The number of times of response is less than default Second Threshold, then the number of times being continuously not received by the response that described server returns adds 1, and Send heartbeat data packets using short heart beating to server;
After sending heartbeat data packets using short heart beating to server, if receiving the response that described server returns, Then return the described last eartbeat interval finally detecting using described heartbeat detection period and send heartbeat data to server The step of bag.
Further, the described action stablizing heart beating period, can also include:
After sending heartbeat data packets using short heart beating to server, if being not received by answering of described server return Answer, then return the described number of times being continuously not received by the response that described server returns and add 1, and using short heart beating to service The step that device sends heartbeat data packets.
Further, the described action stablizing heart beating period, can also include:
Send heart beating in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After packet, if being not received by the response of described server return and being continuously not received by what described server returned The number of times of response is more than default Second Threshold, then return the beginning in described short heart beating period.
In a particular application, for example, described default Second Threshold can be preferably 3 times, described default Second Threshold Specifically can be arranged with practical situation, the present embodiment is not limited.
Fig. 5 shows total logic flow schematic diagram of dynamic instrumentation heart pattern, in figure:
Represent the number of times of successive heartbeat failure with lastfailhbcount, that is, interim when stablizing heart beating continuously do not connect Receive the number of times of the response that described server returns.
In a particular application, the action of described fixing heart pattern, can specifically include:
The last eartbeat interval finally being detected using described dynamic instrumentation heart pattern sends beats to server According to bag.
Dynamic network heart beating processing method in the instant messaging of the present embodiment, can when network changes as early as possible Detect the availability of network, receive message in time, improve the experience of application program, dynamic detection network heart beating can Effectively save flow and energy resource consumption, reduce the cost of use of user.
Fig. 6 shows the structural representation of the terminal that one embodiment of the invention provides, as shown in fig. 6, the end of the present embodiment End, comprising: the first sending module 61 and the second sending module 62;Wherein:
First sending module 61, is in running status for instant messaging application program in the terminal and terminal is in During dormancy/black state, or when instant messaging application program in the terminal is in background operation state, by dynamic instrumentation Heart pattern sends heartbeat data packets to server;
Second sending module 62, when being in foreground activation running status for instant messaging application program in the terminal, Heartbeat data packets are sent to server by fixing heart pattern.
It should be noted that for device/system embodiment, due to itself and embodiment of the method basic simlarity, so Describe is fairly simple, and in place of correlation, the part referring to embodiment of the method illustrates.
The terminal of the present embodiment, can detect the availability of network when network changes as early as possible, receive in time Message, improves the experience of application program, and flow and energy resource consumption can be effectively saved in dynamic detection network heart beating, fall The cost of use of low user.
The terminal of the present embodiment, can be used for executing the technical scheme of embodiment of the method shown in aforementioned Fig. 1, it realizes principle Similar with technique effect, here is omitted.
Those skilled in the art are it should be appreciated that embodiments herein can be provided as method, system or computer program Product.Therefore, the application can be using complete hardware embodiment, complete software embodiment or the reality combining software and hardware aspect Apply the form of example.And, the application can be using in one or more computers wherein including computer usable program code The upper computer program implemented of usable storage medium (including but not limited to disk memory, cd-rom, optical memory etc.) produces The form of product.
The application is the flow process with reference to method, equipment (system) and computer program according to the embodiment of the present application Figure and/or block diagram are describing.It should be understood that can be by each stream in computer program instructions flowchart and/or block diagram Flow process in journey and/or square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processor instructing general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device is to produce A raw machine is so that produced for reality by the instruction of computer or the computing device of other programmable data processing device The device of the function of specifying in present one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and can guide computer or other programmable data processing device with spy Determine in the computer-readable memory that mode works so that the instruction generation inclusion being stored in this computer-readable memory refers to Make the manufacture of device, this command device realize in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or The function of specifying in multiple square frames.
These computer program instructions also can be loaded in computer or other programmable data processing device so that counting On calculation machine or other programmable devices, execution series of operation steps to be to produce computer implemented process, thus in computer or On other programmable devices, the instruction of execution is provided for realizing in one flow process of flow chart or multiple flow process and/or block diagram one The step of the function of specifying in individual square frame or multiple square frame.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality Body or operation are made a distinction with another entity or operation, and not necessarily require or imply these entities or deposit between operating In any this actual relation or order.And, term " inclusion ", "comprising" or its any other variant are intended to Comprising of nonexcludability, wants so that including a series of process of key elements, method, article or equipment and not only including those Element, but also include other key elements being not expressly set out, or also include for this process, method, article or equipment Intrinsic key element.In the absence of more restrictions, the key element that limited by sentence "including a ..." it is not excluded that Also there is other identical element including in the process of described key element, method, article or equipment.Term " on ", D score etc. refers to The orientation showing or position relationship are based on orientation shown in the drawings or position relationship, are for only for ease of the description present invention and simplification Description, rather than indicate or imply that the system of indication or element must have specific orientation, with specific azimuth configuration and behaviour Make, be therefore not considered as limiting the invention.Unless otherwise clearly defined and limited, term " installation ", " being connected ", " connection " should be interpreted broadly, for example, it may be being fixedly connected or being detachably connected, or is integrally connected;Can be It is mechanically connected or electrically connect;Can be to be joined directly together it is also possible to be indirectly connected to by intermediary, can be two The connection of element internal.For the ordinary skill in the art, above-mentioned term can be understood as the case may be at this Concrete meaning in invention.
In the description of the present invention, illustrate a large amount of details.Although it is understood that, embodiments of the invention can To put into practice in the case of there is no these details.In some instances, known method, structure and skill are not been shown in detail Art, so as not to obscure the understanding of this description.Similarly it will be appreciated that disclosing and help understand respectively to simplify the present invention One or more of individual inventive aspect, in the description to the exemplary embodiment of the present invention above, each of the present invention is special Levy and be sometimes grouped together in single embodiment, figure or descriptions thereof.However, should not be by the method solution of the disclosure Release is in reflect an intention that i.e. the present invention for required protection requires than the feature being expressly recited in each claim more Many features.More precisely, as the following claims reflect, inventive aspect is less than single reality disclosed above Apply all features of example.Therefore, it then follows claims of specific embodiment are thus expressly incorporated in this specific embodiment, Wherein each claim itself is as the separate embodiments of the present invention.It should be noted that in the case of not conflicting, this Embodiment in application and the feature in embodiment can be mutually combined.The invention is not limited in any single aspect, It is not limited to any single embodiment, be also not limited to combination in any and/or the displacement of these aspects and/or embodiment.And And, can be used alone each aspect of the present invention and/or embodiment or with other aspects one or more and/or its enforcement Example is used in combination.
Finally it is noted that various embodiments above, only in order to technical scheme to be described, is not intended to limit;To the greatest extent Pipe has been described in detail to the present invention with reference to foregoing embodiments, it will be understood by those within the art that: its according to So the technical scheme described in foregoing embodiments can be modified, or wherein some or all of technical characteristic is entered Row equivalent;And these modifications or replacement, do not make the essence of appropriate technical solution depart from various embodiments of the present invention technology The scope of scheme, it all should be covered in the middle of the claim of the present invention and the scope of description.

Claims (10)

1. the dynamic network heart beating processing method in a kind of instant messaging, is applied to terminal it is characterised in that including:
Instant messaging application program in the terminal is in running status and when terminal is in dormancy/black state, or When instant messaging application program in terminal is in background operation state, the heart is sent to server by dynamic instrumentation heart pattern Jump packet;
When instant messaging application program in the terminal is in foreground activation running status, by fixing heart pattern to server Send heartbeat data packets.
2. method according to claim 1 is it is characterised in that described dynamic instrumentation heart pattern, comprising: short heart beating period Action, the action in heartbeat detection period and the action stablizing heart beating period.
3. method according to claim 2 is it is characterised in that the action in described short heart beating period, comprising:
When being switched to a new network, send heartbeat data packets, the interval of described short heart beating using short heart beating to server For presetting first time period;
If the number of times continuously receiving the response that described server returns is more than preset first threshold value, enter described heartbeat detection Period.
4. method according to claim 3 is it is characterised in that the action in described heartbeat detection period, comprising:
When entering described heartbeat detection period, current heartbeat interval and last eartbeat interval is made to be equal to the heart beating of default minimum Interval;
It is spaced using current heartbeat and send heartbeat data packets to server;
If receiving the response that described server returns, the last eartbeat interval of order is equal to current heartbeat and is spaced, and then order is worked as Front eartbeat interval increases default second time period;
Judge current heartbeat interval whether more than or equal to default maximum eartbeat interval;
If current heartbeat interval is more than or equal to default maximum eartbeat interval, current heartbeat interval is made to be equal between the heart beating of default maximum Every then making last eartbeat interval be equal to current heartbeat and be spaced, subsequently into stablizing heart beating period;
If current heartbeat interval is less than default maximum eartbeat interval, return is spaced using current heartbeat and sends heart beating to server The step of packet.
5. method according to claim 4, it is characterised in that the action in described heartbeat detection period, also includes:
After described use current heartbeat is spaced and sends heartbeat data packets to server, if be not received by described server returning The response returned, then enter and stablize heart beating period.
6. method according to claim 4 is it is characterised in that the described action stablizing heart beating period, comprising:
The last eartbeat interval finally being detected using described heartbeat detection period sends heartbeat data packets to server;
Send heartbeat data in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After bag, if being not received by the response returning of described server and the response being continuously not received by described server return Number of times be less than default Second Threshold, then the number of times being continuously not received by the response that described server returns adds 1, and uses Short heart beating sends heartbeat data packets to server;
After sending heartbeat data packets using short heart beating to server, if receiving the response that described server returns, return Return the described last eartbeat interval finally detecting using described heartbeat detection period and send heartbeat data packets to server Step.
7. method according to claim 6, it is characterised in that the described action stablizing heart beating period, also includes:
After sending heartbeat data packets using short heart beating to server, if being not received by the response that described server returns, Then return the described number of times being continuously not received by the response that described server returns and add 1, and using short heart beating to server The step sending heartbeat data packets.
8. method according to claim 6, it is characterised in that the described action stablizing heart beating period, also includes:
Send heartbeat data in the described upper once eartbeat interval finally detecting using described heartbeat detection period to server After bag, if being not received by the response returning of described server and the response being continuously not received by described server return Number of times be more than default Second Threshold, then return the beginning in described short heart beating period.
9. method according to claim 6 is it is characterised in that the action of described fixing heart pattern, comprising:
The last eartbeat interval finally being detected using described dynamic instrumentation heart pattern sends heartbeat data packets to server.
10. a kind of terminal is it is characterised in that include:
First sending module, be in running status for instant messaging application program in the terminal and terminal be in dormancy/ During black state, or when instant messaging application program in the terminal is in background operation state, by dynamic instrumentation heart beating Pattern sends heartbeat data packets to server;
Second sending module, when being in foreground activation running status for instant messaging application program in the terminal, by solid Centering hop pattern sends heartbeat data packets to server.
CN201610785094.7A 2016-08-30 2016-08-30 Dynamic network heartbeat processing method and terminal in instant messaging Active CN106375148B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610785094.7A CN106375148B (en) 2016-08-30 2016-08-30 Dynamic network heartbeat processing method and terminal in instant messaging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610785094.7A CN106375148B (en) 2016-08-30 2016-08-30 Dynamic network heartbeat processing method and terminal in instant messaging

Publications (2)

Publication Number Publication Date
CN106375148A true CN106375148A (en) 2017-02-01
CN106375148B CN106375148B (en) 2019-05-21

Family

ID=57899521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610785094.7A Active CN106375148B (en) 2016-08-30 2016-08-30 Dynamic network heartbeat processing method and terminal in instant messaging

Country Status (1)

Country Link
CN (1) CN106375148B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106850355A (en) * 2017-02-24 2017-06-13 上海微喂网络科技有限公司 Apply the full-time monitoring intelligent heartbeat method in real-time intercommunication network
CN110474975A (en) * 2019-08-08 2019-11-19 北京云中融信网络科技有限公司 Heartbeat processing method, device, electronic equipment and the storage medium of application program
CN110493070A (en) * 2018-05-15 2019-11-22 深圳市尚云互联技术有限公司 Suspension notification method and its application system
CN112839106A (en) * 2021-02-25 2021-05-25 北京北信源软件股份有限公司 Communication method and apparatus, electronic device, and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080165796A1 (en) * 2007-01-05 2008-07-10 International Business Machines Corporation Method for a heartbeat algorithm for a dynamically changing network environment
CN102223257A (en) * 2011-07-25 2011-10-19 莫雅静 Heartbeat interval adjusting method, server, client terminal and communication system
CN102821011A (en) * 2012-08-28 2012-12-12 北京星网锐捷网络技术有限公司 Opposite terminal state detection method, device and equipment
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104144159A (en) * 2014-06-26 2014-11-12 腾讯科技(深圳)有限公司 Intelligent heartbeat keeping method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080165796A1 (en) * 2007-01-05 2008-07-10 International Business Machines Corporation Method for a heartbeat algorithm for a dynamically changing network environment
CN102223257A (en) * 2011-07-25 2011-10-19 莫雅静 Heartbeat interval adjusting method, server, client terminal and communication system
CN102821011A (en) * 2012-08-28 2012-12-12 北京星网锐捷网络技术有限公司 Opposite terminal state detection method, device and equipment
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104144159A (en) * 2014-06-26 2014-11-12 腾讯科技(深圳)有限公司 Intelligent heartbeat keeping method and system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106850355A (en) * 2017-02-24 2017-06-13 上海微喂网络科技有限公司 Apply the full-time monitoring intelligent heartbeat method in real-time intercommunication network
CN110493070A (en) * 2018-05-15 2019-11-22 深圳市尚云互联技术有限公司 Suspension notification method and its application system
CN110474975A (en) * 2019-08-08 2019-11-19 北京云中融信网络科技有限公司 Heartbeat processing method, device, electronic equipment and the storage medium of application program
CN110474975B (en) * 2019-08-08 2022-03-15 北京云中融信网络科技有限公司 Heartbeat processing method and device of application program, electronic equipment and storage medium
CN112839106A (en) * 2021-02-25 2021-05-25 北京北信源软件股份有限公司 Communication method and apparatus, electronic device, and medium

Also Published As

Publication number Publication date
CN106375148B (en) 2019-05-21

Similar Documents

Publication Publication Date Title
CN106375148A (en) Dynamic network heartbeat processing method in instant communication and terminal
CN105635248B (en) A kind of method for releasing and system of TCP connection resource
CN104812094B (en) The connection method for building up and device of equipment room
CN104125141B (en) A kind of method for pushing of notification message, server and system
CN108430116A (en) Suspension reconnection method, medium, device and computing device
CN110708696B (en) Network data recovery method and device, storage medium and electronic equipment
CN107919994B (en) Method and server for realizing hot standby of network service dual-computer
CN108712485A (en) A kind of resource subscription method and apparatus of internet of things equipment
CN108449239A (en) Heartbeat packet method, apparatus, equipment and storage medium
CN103338144B (en) A kind of session data synchronous method and device
CN105771243A (en) Method and system for achieving multiplayer voice interaction in mobile terminal game
CN111064552B (en) Intelligent device control method and device, electronic device and storage medium
WO2020063021A1 (en) Eye tracking method, apparatus and system applied to terminal device
CN109769029B (en) Communication connection method based on electricity consumption information acquisition system and terminal equipment
CN106685800B (en) The based reminding method and device of information
CN109040295A (en) Determination method and device, terminal and the storage medium of abnormal broken line
CN107104822B (en) Server disaster recovery processing method and device, storage medium and electronic equipment
WO2018000570A1 (en) Bluetooth pairing method, apparatus and system
CN109327383A (en) A kind of fault handling method and equipment
CN114357495A (en) Prediction machine under-chain aggregation method, device, equipment and medium based on block chain
CN110321203B (en) Background process false death processing method and client
CN104243473B (en) A kind of method and device of data transmission
US20180110091A1 (en) Data Transmission Method and Apparatus for Data Service
CN103580951B (en) Output comparative approach, test migration householder method and the system of multiple information systems
CN112738865A (en) Service processing method and device and electronic equipment

Legal Events

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