CN110381130A - The long connection method of keep-alive, device, communication terminal and storage medium - Google Patents

The long connection method of keep-alive, device, communication terminal and storage medium Download PDF

Info

Publication number
CN110381130A
CN110381130A CN201910630172.XA CN201910630172A CN110381130A CN 110381130 A CN110381130 A CN 110381130A CN 201910630172 A CN201910630172 A CN 201910630172A CN 110381130 A CN110381130 A CN 110381130A
Authority
CN
China
Prior art keywords
communication terminal
operating status
server
heartbeat packet
bright screen
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
CN201910630172.XA
Other languages
Chinese (zh)
Other versions
CN110381130B (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.)
New Cloud Technology Group Co ltd
Original Assignee
Hunan New Cloudnet 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 Hunan New Cloudnet Technology Co Ltd filed Critical Hunan New Cloudnet Technology Co Ltd
Priority to CN201910630172.XA priority Critical patent/CN110381130B/en
Publication of CN110381130A publication Critical patent/CN110381130A/en
Application granted granted Critical
Publication of CN110381130B publication Critical patent/CN110381130B/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
    • H04L43/103Active monitoring, e.g. heartbeat, ping or trace-route with adaptive polling, i.e. dynamically adapting the polling rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session

Abstract

The present invention is suitable for Network Connection field, provides a kind of long connection method of keep-alive, device, communication terminal and storage medium, comprising: at interval of the first predetermined time, obtain the operating status of communication terminal;According to the operation state, it matches corresponding heartbeat packet and sends frequency;Frequency is sent according to the heartbeat packet, sends heartbeat packet to server.By obtaining the operating status of mobile terminal, matches different heartbeat packets and send frequency, reasonably to control heartbeat packet transmission frequency, extend mobile terminal and use the time.

Description

The long connection method of keep-alive, device, communication terminal and storage medium
Technical field
The invention belongs to field of communication technology more particularly to a kind of long connection method of keep-alive, device, communication terminal and storages Medium.
Background technique
With the continuous development of the communication technology, various communication terminals emerge one after another, and are daily production and the life band of people Great convenience is carried out, for example, the mobile terminals such as mobile phone, tablet computer, personal digital assistant.In order to guarantee the communication of communication terminal Function is not interrupted, and generallys use the long connection type of keep-alive to realize the communication connection between communication terminal and server.Commonly The long connection type of keep-alive is to send a heartbeat data packets every fixed time period, and this long connection type of keep-alive cannot be controlled rationally Heartbeat packet processed sends frequency, and power consumption is big and memory usage is high.
Summary of the invention
In view of this, the embodiment of the invention provides the long connection method of keep-alive, device, communication terminal and storage medium, with Heartbeat packet transmission frequency cannot rationally be controlled by solving the long connection type of existing keep-alive, and power consumption is big and memory usage is high asks Topic.
The first aspect of the embodiment of the present invention provides a kind of long connection method of keep-alive, comprising:
At interval of the first predetermined time, the operating status of communication terminal is obtained;
According to the operation state, it matches corresponding heartbeat packet and sends frequency;
Frequency is sent according to the heartbeat packet, sends heartbeat packet to server.
In one embodiment, according to the operation state, it matches corresponding heartbeat packet and sends frequency, comprising:
Judge whether the operating status is bright screen state;
If the operating status be bright screen state, judge under the bright screen state, the communication terminal whether with server Data interaction occurs;
If under the bright screen state, the communication terminal and server do not occur that data interaction occurs, the communication is determined Terminal is the first operating status;
According to first operating status, matches corresponding heartbeat packet and send frequency.
In one embodiment, after judging whether the operating status is bright screen state, further includes:
If the operating status is non-bright screen state, when obtaining the operating status and being switched to the starting of non-bright screen state Between;
Judge in the second predetermined time since the initial time, whether the operating status is switched to bright screen shape State;
If the operating status is switched to bright screen state, adjustment heartbeat packet sends frequency;
Frequency is sent according to heartbeat packet adjusted, sends heartbeat packet to server.
In one embodiment, if the operating status is bright screen state, judge under the bright screen state, the communication is eventually Whether end occurs with server after data interaction, comprising:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is Second operating status;
According to second operating status, heartbeat packet is not sent to server.
In one embodiment, frequency is sent according to the heartbeat packet, after sending heartbeat packet to server, including
In third preset time period, the feedback information for receiving server transmission is detected whether;
If not receiving the feedback information of server transmission, determine that long connection has disconnected;
Show that the first operational order option list selected for user, the first operational order option list include holding Supervention send heartbeat packet at least one of server and the long connection of interruption;
The first operational order for receiving user's selection executes corresponding operating according to first operational order.
The second aspect of the embodiment of the present invention provides a kind of long attachment device of keep-alive, comprising:
Module is obtained, for obtaining the operating status of communication terminal at interval of the first predetermined time;
Matching module sends frequency for according to the operation state, matching corresponding heartbeat packet;
Sending module sends heartbeat packet to server for sending frequency according to the heartbeat packet.
In one embodiment, the matching module is also used to:
Judge whether the operating status is bright screen state;
If the operating status be bright screen state, judge under the bright screen state, the communication terminal whether with server Data interaction occurs;
If under the bright screen state, data interaction does not occur for the communication terminal and server, the communication terminal is determined For the first operating status;
According to first operating status, matches the corresponding heartbeat packet and send frequency.
In one embodiment, the matching module is also used to:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is Second operating status;
According to second operating status, heartbeat packet is not sent to server.
The third aspect of the embodiment of the present invention provides a kind of long connection communication terminal of keep-alive, comprising: memory, processor And the computer program that can be run in the memory and on the processor is stored, the processor executes the meter It realizes when calculation machine program such as the step of the above method.
The fourth aspect of the embodiment of the present invention provides a kind of computer readable storage medium, comprising: the computer can The step of reading storage medium and be stored with computer program, the above method is realized when the computer program is executed by processor.
The embodiment of the present invention can be matched different by the operating status of acquisition communication terminal according to different operating statuses Heartbeat packet sends frequency, and the heartbeat packet under non-bright screen state sends frequency and sends frequency lower than the heartbeat packet under bright screen state, with This, which reasonably to control heartbeat packet, sends frequency, and communication terminal power consumption and memory usage can be effectively reduced.
Detailed description of the invention
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only of the invention some Embodiment for those of ordinary skill in the art without creative efforts, can also be attached according to these Figure obtains other attached drawings.
Fig. 1 is the implementation process schematic diagram of the long connection method of keep-alive provided in an embodiment of the present invention;
Fig. 2 is the structural schematic diagram of the long attachment device of keep-alive provided in an embodiment of the present invention;
Fig. 3 is the schematic diagram of the long connection communication terminal of keep-alive provided in an embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical solution in the embodiment of the present invention are explicitly described, it is clear that described embodiment is the present invention one The embodiment divided, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not doing Every other embodiment obtained under the premise of creative work out, should fall within the scope of the present invention.
Description and claims of this specification and term " includes " and their any deformations in above-mentioned attached drawing, meaning Figure, which is to cover, non-exclusive includes.Such as process, method or system comprising a series of steps or units, product or equipment do not have It is defined in listed step or unit, but optionally further comprising the step of not listing or unit, or optionally also wrap Include the other step or units intrinsic for these process, methods, product or equipment.In addition, term " first ", " second " and " third " etc. is for distinguishing different objects, not for description particular order.
Embodiment one
The present embodiment provides a kind of long connection methods of keep-alive, are applied to communication terminal, and communication terminal can be mobile phone, plate The mobile terminals such as computer, electronics school board, personal digital assistant, laptop are also possible to personal computer, desktop calculates The immobile terminals such as machine, self-service terminal machine.
As shown in Figure 1, the long connection method of keep-alive provided in this embodiment, comprising:
S10, at interval of the first predetermined time, obtain the operating status of communication terminal;
In the application, the first predetermined time can be set as any time according to actual needs, for example, in 1S~60S Any time.First predetermined time can be the time of systemic presupposition, or user's customized time, operating status packet Include bright screen state and non-bright screen state, wherein bright screen state include talking state, information transmitting state, information search state, it is non- Bright screen state includes dormant state, off-mode etc., is not specially limited to this.
S20, according to the operation state matches corresponding heartbeat packet and sends frequency;
In the application, different operating statuses corresponds to different heartbeat packets and sends frequency, presets different heartbeat packets Frequency is sent, so that different heartbeat packets is sent frequency and different operating statuses is respectively associated, and store its related information.Wherein, Heartbeat packet under settable dormant state sends frequency and sends frequency far below the heartbeat packet under other operating statuses, can also root Be set as optional frequency according to actual needs, as a heartbeat packet sent automatically to server every 1S, putting out screen shape under bright screen state Under state, every one heartbeat packet of transmission in 1min to server, specifically, heartbeat packet sends the hair that frequency can be systemic presupposition Send frequency, or the customized transmission frequency of user is not specially limited this.
In one embodiment, step S20 is specifically included:
Judge whether the operating status is bright screen state;
If the operating status is bright screen state, judge under the bright screen state, whether the communication terminal and server Data interaction occurs;
If under the bright screen state, data interaction does not occur for the communication terminal and server, the communication terminal is determined For the first operating status;
According to first operating status, matches corresponding heartbeat packet and send frequency.
In the application, above-mentioned to judge whether it is bright screen state, itself screen is detected for communication terminal and is shone, and judges communication eventually End is bright screen state or communication terminal detects the operational order that internal processes software receives user, judges that communication terminal is Bright screen state need to wake up communication terminal if user carries out information transmitting by communication terminal in advance.
In the application, under the above-mentioned judgement bright screen state, whether communication terminal and server occur data interaction, can be with For under bright screen state, whether communication terminal has also set up with server is connect, wherein server can be and communication terminal pair The local server (server of developer's setting) answered, or other APP softwares of some loads on communication terminals Corresponding third server, is not construed as limiting this.For example, communication terminal is communicated with other terminals by chat software, or Person runs other instant communication functions such as internet game, then it is assumed that data interaction occurs for communication terminal, is not construed as limiting to this.
In the application, data interaction does not occur for above-mentioned judgement communication terminal and server, can run for communication terminal Single-play game browses the document downloaded or data, at this time it is believed that with server data interaction does not occur for communication terminal, Judgement communication terminal is the first operating status, is not construed as limiting to this.
Above-mentioned first operating status is the further subdivision under bright screen state, after being determined as the first operating status, service Device determines that communication terminal does not need to keep connecting with the server moment at this time, then can match corresponding heartbeat packet and send frequency, such as A heartbeat packet is sent every 30S, frequency is sent and is higher than the transmission frequency put out under screen state, is conducive to receive server transmission Data.
In one embodiment, if the operating status is bright screen state, judge under the bright screen state, the communication terminal After whether occurring data interaction with server, comprising:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is Second operating status;
According to second operating status, heartbeat packet is not sent to server.
In the application, the second operating status is that data interaction occurs for communication terminal and server, i.e., communication terminal and other Terminal is communicated by chat software, or is run internet game or carried out document browsing online, then it is assumed that communication terminal Data interaction occurs with server, this is not construed as limiting.
In the application, include under above-mentioned second operating status but be not limited to communication terminal and server progress data interaction Under state, heartbeat packet is not sent to server.In the state that communication terminal and server carry out data interaction, even if not sending Heartbeat packet, server can be because communication terminal closing time of long connection with serial communication and delaying.So also It is to say that the length between communication terminal and server is connected after continuation of insurance in the state that communication terminal and server carry out data interaction It holds, but during carrying out data interaction state, it is corresponding not in transmission heartbeat packet to server, i.e. the second operating status It is zero that heartbeat packet, which sends frequency,.
In the application, after communication terminal and server carry out under data interaction state, communication terminal detection the 4th is pre- If whether not carrying out data interaction with server in the time, if so, confirmation communication terminal is in the second operating status, according to second Operating status matches corresponding heartbeat packet and sends frequency, as do not sent heartbeat packet to server during the second operating status.On It states the 4th preset time and can be actually needed according to and be set as any time, or the time of systemic presupposition, not to this It limits.Above-mentioned communication terminal detects in the 4th preset time whether do not carry out data interaction with server, can be to chat Software operation carry out information exchange state under, in the 4th preset time, do not receive or send information, then it is assumed that communication terminal not in Server sends data interaction, or under webpage operating status, not more new web page in the 4th preset time, then it is assumed that communication is eventually End does not send data interaction in server.The initial time of above-mentioned 4th preset time can be between communication terminal and server It does not carry out the time of data interaction, terminal time is a period of setting, and such as 10min has not occurred number in 10min According to connection, then it is assumed that communication terminal does not send data interaction with server, can obtain the operating status of communication terminal at this time later, According to the operating status of communication terminal, selects corresponding heartbeat packet to send frequency and carry out the long connection of keep-alive.
In one embodiment, after judging whether the operating status is bright screen state, further includes:
If the operating status is non-bright screen state, obtains the communication terminal operating status and be switched to non-bright screen state Initial time;
Judge in the second predetermined time since the initial time, whether the communication terminal operating status is switched to Bright screen state;
If the operating status is switched to bright screen state, adjustment heartbeat packet sends frequency;
Frequency is sent according to heartbeat packet adjusted, sends heartbeat packet to server.
In the application, non-bright screen state is standby mode, and the interface of communication terminal does not show any information.
In the application, the initial time that the communication terminal operating status is switched to non-bright screen state is obtained, can be bright Because preset rules automatically become the initial time of standby mode under screen state, the initial time that communication terminal record switches at this time is Initial time, preset rules can preset for communication terminal and not receive operational order in 1min and become automatic stand-by, Standby key being clicked for user and entering standby mode, this is not construed as limiting.It should be noted that if detecting that user clicks Standby key enters standby mode, then shows that user is not needed at present using communication terminal, then can will bright screen state non-at this time Under heartbeat packet send frequency further reduce, if communication terminal be 1min in do not receive operational order become automatically to Machine then can persistently use the heartbeat packet under bright screen state to send frequency in a period of time after being converted under non-bright screen state Rate, above-mentioned a period of time can set certainly for system or user setting, is not particularly limited to this.
In the application, in the second predetermined time, any time can be set as according to actual needs, it is believed that communicating The bright screen state of terminal is switched to moment of non-bright screen state as initial time, terminal time be user or communication terminal from If period.If communication terminal is constantly in bright screen state, user's screen locking in 9:00, then 9:00 is determined as the second pre- timing Between initial time, until a period later, the period can be set to 5min, i.e. 9:00-9:05 is the second pre- timing Between, within the time period, if communication terminal is not switched to bright screen state, then adjust the transmission frequency of heartbeat packet.
S30, frequency is sent according to the heartbeat packet, sends heartbeat packet to server.
In the application, the transmission frequency of heartbeat packet is to preset inside communication terminal, and heartbeat packet sends frequency A heartbeat packet is including but not limited to sent automatically to server every 1S, is extremely serviced every sending a heartbeat packet in 1min Device, or under certain operating status, do not send heartbeat packet to server, wherein certain operating status includes but unlimited In the second operating status for carrying out data interaction with server, this is not specially limited.
In one embodiment, after step S30, comprising:
In third preset time period, the feedback information for receiving server transmission is detected whether;
If not receiving the feedback information of server transmission, determine that long connection has disconnected;
Show that the first operational order option list selected for user, the first operational order option list include holding Supervention send heartbeat packet at least one of server and the long connection of interruption;
The first operational order for receiving user's selection executes corresponding operating according to first operational order.
In the application, in third preset time period, it is believed that sending the moment of heartbeat packet to server as starting Time, terminal time are the period that user or communication terminal are 5S from the period set, such as third preset time period, It does not limit this.The empty data packet that above-mentioned feedback information can send for server, does not include any data, for dimension Hold the effect connected between communication terminal and server.
In the application, the first operational order option list determines that long connection is already off for communication terminal, later at interface Upper display persistently sends heartbeat packet to server and interrupts two kinds of option lists in long connection, in table form, or it is sliding The form in arena face is shown on the interface of communication terminal, can make the mode presented identical with the first operational order option list Or it is different, this is not construed as limiting.
In other application, to avoid the case where repeatedly reminding repeatedly, occurring not receiving in 5s twice in succession The feedback information of server, and the operational order of user is default duration hair in the case where persistently sending heartbeat packet to server Send heartbeat packet to server.For example, user is now in the weak region of signal, if user's selection persistently sends heartbeat packet to service Then there is the case where not receiving the feedback information of server again after 5S generation, remind repeatedly user in device, can The usage experience of user can be reduced, therefore, system then defaults the transmission frequency of the heartbeat packet before maintaining.
The present embodiment matches different heartbeat packets and sends frequency by the operating status of acquisition communication terminal, comes reasonable It controls heartbeat packet and sends frequency, communication terminal power consumption and memory usage can be effectively reduced.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit It is fixed.
Embodiment two
The present embodiment provides a kind of long attachment devices of keep-alive, for executing the method and step in embodiment one.
As shown in Fig. 2, the present invention also provides a kind of long attachment devices 100 of keep-alive, comprising:
Module 10 is obtained, for obtaining the operating status of mobile terminal at interval of the first predetermined time;
Matching module 20 sends frequency for according to the operation state, matching corresponding heartbeat packet;
Sending module 30 sends heartbeat packet to server for sending frequency according to the heartbeat packet.
In one embodiment, matching module 20 is specifically used for:
Judge whether the operating status is bright screen state;
If the operating status is bright screen state, judge under the bright screen state, whether the communication terminal and server Data interaction occurs;
If under the bright screen state, data interaction does not occur for the communication terminal and server, the communication terminal is determined For the first operating status;
According to first operating status, matches corresponding heartbeat packet and send frequency.
In one embodiment, matching module 20 are also used to:
If the operating status is non-bright screen state, when obtaining the operating status and being switched to the starting of non-bright screen state Between;
Judge in the second predetermined time since the initial time, whether the operating status is switched to bright screen shape State;
If the operating status is switched to bright screen state, adjustment heartbeat packet sends frequency;
Frequency is sent according to heartbeat packet adjusted, sends heartbeat packet to server.
In one embodiment, matching module 20 is also used to:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is Second operating status;
According to second operating status, heartbeat packet is not sent to server.
In the application, include under above-mentioned second operating status but be not limited to communication terminal and server progress data interaction Under state, heartbeat packet is not sent to server, the long connection between communication terminal and server continues to keep, but is being counted According to during interaction mode, heartbeat packet is not being sent to server, i.e. the second operating status, corresponding heartbeat packet sends frequency and is Zero.
Such as Fig. 2, in one embodiment, the long attachment device 100 of keep-alive further includes
Detection module 40 is used in third preset time period, detects whether the feedback information for receiving server transmission;
Determination module 50 determines that long connection has disconnected if the feedback information for not receiving server transmission;
Display module 60, for showing the first operational order option list for user's selection, first operation refers to Enabling option list includes persistently sending heartbeat packet at least one of server and the long connection of interruption;
Receiving module 70 executes phase according to first operational order for receiving the first operational order of user's selection It should operate.
The present embodiment matches different heartbeat packets and sends frequency by the operating status of acquisition communication terminal, comes reasonable It controls heartbeat packet and sends frequency, communication terminal power consumption and memory usage can be effectively reduced.
Embodiment three
Fig. 3 is the schematic diagram for the long connection communication terminal of keep-alive that one embodiment of the invention provides.As shown in figure 3, the implementation The long connection communication terminal 80 of keep-alive of example includes: processor 803, memory 801 and is stored in the memory 801 and can The computer program 802 run on the processor 803.The realization when processor 803 executes the computer program 802 Step in the above-mentioned long connection method embodiment of each keep-alive, such as step S10 to S30 shown in FIG. 1.Alternatively, the processing Device 803 realizes the function of each module/unit in above-mentioned each Installation practice when executing the computer program 802.
Illustratively, the computer program 802 can be divided into one or more module/units, it is one or Multiple module/the units of person are stored in the memory 801, and are executed by the processor 803, to complete the present invention.Institute Stating one or more module/units can be the series of computation machine program instruction section that can complete specific function, the instruction segment For describing implementation procedure of the computer program 802 in the long connection/communication terminal 6 of the keep-alive.For example, the calculating It is as follows that machine program 802 can be divided into acquisition module, matching module and sending module, each module concrete function:
Module is obtained, for obtaining the operating status of communication terminal at interval of the first predetermined time;
Matching module sends frequency for according to the operation state, matching corresponding heartbeat packet;
Sending module sends heartbeat packet to server for sending frequency according to the heartbeat packet.The long connection of the keep-alive Communication terminal 80 can be desktop PC, notebook, palm PC and cloud server etc. and calculate equipment.The keep-alive is long Connection communication terminal may include, but be not limited only to, processor 803, memory 801.It will be understood by those skilled in the art that Fig. 3 The only example of the long connection communication terminal 80 of keep-alive, does not constitute the restriction to the long connection communication terminal 80 of keep-alive, can wrap It includes than illustrating more or fewer components, perhaps combines certain components or different components, such as the long connection of the keep-alive is led to Believe that terminal can also include input-output equipment, network access equipment, bus etc..
Alleged processor 803 can be central processing unit (Central Processing Unit, CPU), can also be Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor Deng.
The memory 801 can be the internal storage unit of the long connection communication terminal 80 of the keep-alive, such as keep-alive is long The hard disk or memory of connection communication terminal 80.The memory 801 is also possible to the outer of the long connection communication terminal 80 of the keep-alive The plug-in type hard disk being equipped in portion's storage equipment, such as the long connection communication terminal 80 of the keep-alive, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Implement at one In example, the memory 801 can also both internal storage units including the long connection communication terminal 80 of the keep-alive or including outer Portion stores equipment.The memory 801 is for storing needed for the computer program and the long connection communication terminal of the keep-alive Other programs and data.The memory 801 can be also used for temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/communication terminal and method, it can be with It realizes by another way.For example, device/communication terminal embodiment described above is only schematical, for example, institute The division of module or unit is stated, only a kind of logical function partition, there may be another division manner in actual implementation, such as Multiple units or components can be combined or can be integrated into another system, or some features can be ignored or not executed.Separately A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be through some interfaces, device Or the INDIRECT COUPLING or communication connection of unit, it can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or In use, can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-mentioned implementation All or part of the process in example method, can also instruct relevant hardware to complete, the meter by computer program Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on The step of stating each embodiment of the method.Wherein, the computer program includes computer program code, the computer program generation Code can be source code form, object identification code form, executable file or certain intermediate forms etc..The computer-readable medium It may include: any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic that can carry the computer program code Dish, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that described The content that computer-readable medium includes can carry out increasing appropriate according to the requirement made laws in jurisdiction with patent practice Subtract, such as does not include electric carrier signal and electricity according to legislation and patent practice, computer-readable medium in certain jurisdictions Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all It is included within protection scope of the present invention.

Claims (10)

1. a kind of long connection method of keep-alive characterized by comprising
At interval of the first predetermined time, the operating status of communication terminal is obtained;
According to the operation state, it matches corresponding heartbeat packet and sends frequency;
Frequency is sent according to the heartbeat packet, sends heartbeat packet to server.
2. the long connection method of keep-alive as described in claim 1, which is characterized in that according to the operation state, match corresponding Heartbeat packet sends frequency, comprising:
Judge whether the operating status is bright screen state;
If the operating status is bright screen state, judge under the bright screen state, whether the communication terminal occurs with server Data interaction;
If under the bright screen state, the communication terminal and server do not occur that data interaction occurs, the communication terminal is determined For the first operating status;
According to first operating status, matches corresponding heartbeat packet and send frequency.
3. the long connection method of keep-alive as claimed in claim 2, which is characterized in that judge whether the operating status is bright screen shape After state, further includes:
If the operating status is non-bright screen state, the starting that the communication terminal operating status is switched to non-bright screen state is obtained Time;
Judge in the second predetermined time since the initial time, whether the communication terminal operating status is switched to bright screen State;
If the operating status is switched to bright screen state, adjustment heartbeat packet sends frequency;
Frequency is sent according to heartbeat packet adjusted, sends heartbeat packet to server.
4. the long connection method of keep-alive as claimed in claim 2, which is characterized in that if the operating status is bright screen state, sentence Break under the bright screen state, whether the communication terminal occurs with server after data interaction, comprising:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is second Operating status;
According to second operating status, heartbeat packet is not sent to server.
5. the long connection method of keep-alive as described in claim 1, which is characterized in that send frequency according to the heartbeat packet, send After heartbeat packet to server, comprising:
In third preset time period, the feedback information for receiving subordinate server transmission is detected whether;
If not receiving the feedback information that the server is sent, determine that long connection has disconnected;
Show that the first operational order option list selected for user, the first operational order option list include lasting hair Send heartbeat packet at least one of server and the long connection of interruption;
The first operational order for receiving user's selection executes corresponding operating according to first operational order.
6. a kind of long attachment device of keep-alive characterized by comprising
Module is obtained, for obtaining the operating status of communication terminal at interval of the first predetermined time;
Matching module sends frequency for according to the operation state, matching corresponding heartbeat packet;
Sending module sends heartbeat packet to server for sending frequency according to the heartbeat packet.
7. the long attachment device of keep-alive as claimed in claim 6, which is characterized in that the matching module is also used to:
Judge whether the operating status is bright screen state;
If the operating status is bright screen state, judge under the bright screen state, whether the communication terminal occurs with server Data interaction;
If data interaction does not occur for the communication terminal and server under the bright screen state, determine that the communication terminal is the One operating status;
According to first operating status, matches the corresponding heartbeat packet and send frequency.
8. the long attachment device of keep-alive as claimed in claim 7, which is characterized in that the matching module is also used to:
If under the bright screen state, data interaction occurs for the communication terminal and server, determine that the communication terminal is second Operating status;
According to second operating status, heartbeat packet is not sent to server.
9. a kind of communication terminal, including memory, processor and storage are in the memory and can be on the processor The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 5 when executing the computer program The step of any one the method.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists In when the computer program is executed by processor the step of any one of such as claim 1 to 5 of realization the method.
CN201910630172.XA 2019-07-12 2019-07-12 Keep-alive long connection method, device, communication terminal and storage medium Active CN110381130B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910630172.XA CN110381130B (en) 2019-07-12 2019-07-12 Keep-alive long connection method, device, communication terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910630172.XA CN110381130B (en) 2019-07-12 2019-07-12 Keep-alive long connection method, device, communication terminal and storage medium

Publications (2)

Publication Number Publication Date
CN110381130A true CN110381130A (en) 2019-10-25
CN110381130B CN110381130B (en) 2020-05-29

Family

ID=68253044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910630172.XA Active CN110381130B (en) 2019-07-12 2019-07-12 Keep-alive long connection method, device, communication terminal and storage medium

Country Status (1)

Country Link
CN (1) CN110381130B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110740491A (en) * 2019-10-29 2020-01-31 广东美的制冷设备有限公司 Communication processing method and device of wireless network and household appliance
CN112187733A (en) * 2020-09-09 2021-01-05 青岛海信移动通信技术股份有限公司 Network side equipment, terminal and talkback method
CN113542359A (en) * 2021-06-17 2021-10-22 聚好看科技股份有限公司 Terminal state updating method and device in online conference and electronic equipment
CN113746939A (en) * 2021-09-29 2021-12-03 摩拜(北京)信息技术有限公司 Keep-alive period adjusting method and device and vehicle
CN113765948A (en) * 2020-06-02 2021-12-07 华为技术有限公司 Long connection device and network system
CN113835977A (en) * 2021-09-23 2021-12-24 深圳Tcl新技术有限公司 State prompting method and device, computer equipment and computer readable storage medium
CN114585108A (en) * 2020-11-18 2022-06-03 成都鼎桥通信技术有限公司 Connection processing method and device
CN115150307A (en) * 2022-06-30 2022-10-04 北京天融信网络安全技术有限公司 Method and device for detecting acquisition frequency safety, storage medium and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297461A (en) * 2012-02-28 2013-09-11 中国移动通信集团公司 Setting method of NAT conversation keep-alive time duration and client-side and server
CN103491512A (en) * 2012-06-12 2014-01-01 腾讯科技(深圳)有限公司 Implementation method and device for information pushing
CN104253739A (en) * 2013-06-28 2014-12-31 中国移动通信集团公司 Implementing method, system and device of always online services
CN104427598A (en) * 2013-09-09 2015-03-18 中国移动通信集团公司 Heartbeat-free method and device for long-term online service
CN104991850A (en) * 2015-06-27 2015-10-21 广州华多网络科技有限公司 Heartbeat package control method and apparatus for application program
WO2016065552A1 (en) * 2014-10-29 2016-05-06 华为技术有限公司 Heartbeat cycle setting method and terminal
CN105871651A (en) * 2015-12-11 2016-08-17 乐视致新电子科技(天津)有限公司 Device connectivity monitoring method and device
CN105897813A (en) * 2015-06-10 2016-08-24 乐视致新电子科技(天津)有限公司 Heartbeat message sending method, heartbeat message receiving method, heartbeat message sending device and heartbeat message receiving device
CN106851799A (en) * 2017-01-19 2017-06-13 珠海市魅族科技有限公司 The sending method and device of heartbeat packet in a kind of connection long
CN109905259A (en) * 2017-12-08 2019-06-18 中国电信股份有限公司 Communicate to connect maintenance method, system and relevant device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297461A (en) * 2012-02-28 2013-09-11 中国移动通信集团公司 Setting method of NAT conversation keep-alive time duration and client-side and server
CN103491512A (en) * 2012-06-12 2014-01-01 腾讯科技(深圳)有限公司 Implementation method and device for information pushing
CN104253739A (en) * 2013-06-28 2014-12-31 中国移动通信集团公司 Implementing method, system and device of always online services
CN104427598A (en) * 2013-09-09 2015-03-18 中国移动通信集团公司 Heartbeat-free method and device for long-term online service
WO2016065552A1 (en) * 2014-10-29 2016-05-06 华为技术有限公司 Heartbeat cycle setting method and terminal
CN105897813A (en) * 2015-06-10 2016-08-24 乐视致新电子科技(天津)有限公司 Heartbeat message sending method, heartbeat message receiving method, heartbeat message sending device and heartbeat message receiving device
CN104991850A (en) * 2015-06-27 2015-10-21 广州华多网络科技有限公司 Heartbeat package control method and apparatus for application program
CN105871651A (en) * 2015-12-11 2016-08-17 乐视致新电子科技(天津)有限公司 Device connectivity monitoring method and device
CN106851799A (en) * 2017-01-19 2017-06-13 珠海市魅族科技有限公司 The sending method and device of heartbeat packet in a kind of connection long
CN109905259A (en) * 2017-12-08 2019-06-18 中国电信股份有限公司 Communicate to connect maintenance method, system and relevant device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110740491A (en) * 2019-10-29 2020-01-31 广东美的制冷设备有限公司 Communication processing method and device of wireless network and household appliance
CN113765948A (en) * 2020-06-02 2021-12-07 华为技术有限公司 Long connection device and network system
WO2021244087A1 (en) * 2020-06-02 2021-12-09 华为技术有限公司 Long connection apparatus and network system
CN113765948B (en) * 2020-06-02 2022-12-27 华为技术有限公司 Long connection device and network system
CN112187733A (en) * 2020-09-09 2021-01-05 青岛海信移动通信技术股份有限公司 Network side equipment, terminal and talkback method
CN114585108A (en) * 2020-11-18 2022-06-03 成都鼎桥通信技术有限公司 Connection processing method and device
CN113542359A (en) * 2021-06-17 2021-10-22 聚好看科技股份有限公司 Terminal state updating method and device in online conference and electronic equipment
CN113542359B (en) * 2021-06-17 2023-09-05 聚好看科技股份有限公司 Terminal state updating method and device in online conference and electronic equipment
CN113835977A (en) * 2021-09-23 2021-12-24 深圳Tcl新技术有限公司 State prompting method and device, computer equipment and computer readable storage medium
CN113746939A (en) * 2021-09-29 2021-12-03 摩拜(北京)信息技术有限公司 Keep-alive period adjusting method and device and vehicle
CN115150307A (en) * 2022-06-30 2022-10-04 北京天融信网络安全技术有限公司 Method and device for detecting acquisition frequency safety, storage medium and electronic equipment
CN115150307B (en) * 2022-06-30 2023-12-22 珠海天融信网络安全技术有限公司 Method and device for collecting frequency safety detection, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN110381130B (en) 2020-05-29

Similar Documents

Publication Publication Date Title
CN110381130A (en) The long connection method of keep-alive, device, communication terminal and storage medium
CN102999385B (en) Multiprocessor cooperative processing method in computing equipment
CN107484190B (en) Method for connecting network, mobile terminal and computer readable storage medium
CN109636278A (en) Material replenishing method, material goods compensator and terminal device
CN109660665A (en) A kind of screen control method, screen control device and terminal device
CN107197489A (en) Method for switching network, mobile terminal and computer-readable recording medium
CN110445558A (en) Performance test methods, device and terminal device
CN108712559A (en) A kind of disturbance-free method, system and terminal device
CN107784492A (en) Information processing method, device, computer installation and computer-readable recording medium
CN109347938A (en) A kind of flux monitoring method, phone wrist-watch, mobile terminal and server
CN106454936B (en) Network control method and intelligent terminal
CN107765948A (en) Application control method, terminal, computer installation and storage medium
CN112449411A (en) Intelligent equipment working mode switching method and device
CN109614186A (en) Application program color switching method, system and terminal device
CN108509247A (en) A kind of extremely simple mode implementation method, system and terminal device
CN108803304A (en) A kind of electricity-saving control method of smartwatch
CN107612162A (en) A kind of wireless charging method, terminal and computer-readable recording medium
CN108156310A (en) A kind of method and system of finger prints processing, terminal device and computer-readable medium
CN106658457A (en) Reminding method of flow shared by hotspot and terminal
CN110515662A (en) Long-range control method, system, equipment and the readable storage medium storing program for executing of dual-system device
CN109068355A (en) A kind of method, phone wrist-watch, server and mobile terminal for saving data traffic
CN109271266A (en) Document transmission method, device and terminal device
CN106793173B (en) The method and mobile terminal of information processing
CN107608723A (en) One kind application alignment awakening method, terminal and computer-readable recording medium
CN104902581B (en) Wireless connection control method, apparatus and terminal device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Connection method, device, communication terminal and storage medium for keeping alive length

Effective date of registration: 20210126

Granted publication date: 20200529

Pledgee: Agricultural Bank of China Limited Changsha Yuhua District sub branch

Pledgor: HUNAN NEW CLOUDNET TECHNOLOGY Co.,Ltd.

Registration number: Y2021980000747

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 410000 Yuelu District Yuelu street, Changsha, Hunan Province, 5 left 101 rooms of R & D headquarters of Central South University Science Park.

Patentee after: New Cloud Technology Group Co.,Ltd.

Address before: 410000 Yuelu District Yuelu street, Changsha, Hunan Province, 5 left 101 rooms of R & D headquarters of Central South University Science Park.

Patentee before: HUNAN NEW CLOUDNET TECHNOLOGY Co.,Ltd.