CN114126014A - Heartbeat proxy method and device - Google Patents

Heartbeat proxy method and device Download PDF

Info

Publication number
CN114126014A
CN114126014A CN202111300981.8A CN202111300981A CN114126014A CN 114126014 A CN114126014 A CN 114126014A CN 202111300981 A CN202111300981 A CN 202111300981A CN 114126014 A CN114126014 A CN 114126014A
Authority
CN
China
Prior art keywords
heartbeat
proxy
application program
server
application
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.)
Pending
Application number
CN202111300981.8A
Other languages
Chinese (zh)
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202111300981.8A priority Critical patent/CN114126014A/en
Publication of CN114126014A publication Critical patent/CN114126014A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0251Power saving arrangements in terminal devices using monitoring of local events, e.g. events related to user activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/72406User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality by software upgrading or downloading
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72451User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to schedules, e.g. using calendar applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/20Manipulation of established connections
    • H04W76/25Maintenance of established connections
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application discloses a heartbeat proxy method and electronic equipment, and belongs to the field of communication. The heartbeat proxy method is applied to the electronic equipment, and the electronic equipment comprises a heartbeat proxy module; the heartbeat proxy method comprises the following steps: m application programs in the electronic equipment send agent request messages to the heartbeat agent module, wherein the agent request messages carry server addresses corresponding to the M application programs and heartbeat communication formats between the M application programs and the corresponding servers; the heartbeat proxy module stores a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program to a proxy pool; and the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the current network condition.

Description

Heartbeat proxy method and device
Technical Field
The present application belongs to the field of communications technologies, and in particular, to a heartbeat proxy method and apparatus.
Background
With more and more mobile phone applications, various software needing instant communication, such as an instant chat type, a receipt and payment type, a social contact type, an Internet of Things (IOT) type and the like, are installed in a mobile phone of a user, and the software has a commonality that the user needs to keep alive at a mobile phone end by using various means continuously, and meanwhile, communication between at least one Transmission Control Protocol (TCP) long connection and a server is maintained, so that the timeliness of message access is ensured.
In order to maintain the respective long connections, various application programs may occasionally send ping packets to the respective servers, and the corresponding servers may reply to corresponding pong packets, which are commonly referred to as heartbeat packets, and the corresponding ping-pong actions are referred to as heartbeats, which are used to check the health condition of the long connections and also ensure that there is no unexpected drop or disconnection by a Network Address Translation (NAT) router of each Network node, and the like.
Because various application programs are numerous at present and maintain long connection of the application programs, a plurality of disordered awakening actions and network request actions are brought to the system environment of the mobile phone, even though all large mobile phone manufacturers align the awakening actions of the application programs, the power consumption of the mobile phone is still increased, all the application programs also perform a plurality of keep-alive actions for sending heartbeat packets, and the application programs continuously run at the background and occupy more resources of the mobile phone, so that the running performance of the mobile phone is influenced.
Disclosure of Invention
The embodiment of the application aims to provide a heartbeat proxy method and a heartbeat proxy device, and can solve the problems that disordered awakening actions of a system are too much, power consumption of electronic equipment is too high, and running performance of the electronic equipment is affected.
In a first aspect, an embodiment of the present application provides a heartbeat proxy method, where the method includes:
m application programs in the electronic equipment send agent request messages to the heartbeat proxy module, wherein the agent request messages carry server addresses corresponding to the M application programs and heartbeat communication formats between the M application programs and servers corresponding to the M application programs;
the heartbeat proxy module stores a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program into a proxy pool;
and the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the network condition at the current moment.
In a second aspect, an embodiment of the present application provides a heartbeat proxy apparatus, where the apparatus includes:
a first sending module, configured to enable M applications in the electronic device to send a proxy request message to the heartbeat proxy module, where the proxy request message carries server addresses corresponding to the M applications and a heartbeat communication format between the M applications and servers corresponding to the M applications;
the storage module is used for enabling the heartbeat proxy module to store a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program into a proxy pool;
and the second sending module is used for enabling the heartbeat proxy module to send corresponding first heartbeat packets to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the network condition at the current moment.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the steps of the method according to the first aspect.
In the embodiment of the application, the heartbeat proxy requirements of each application program in the electronic equipment are integrated by sending a proxy request message to the heartbeat proxy module by the application program in the electronic equipment, and a corresponding first heartbeat packet is sent to the server corresponding to the application program stored in the proxy pool at intervals of a target time according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, so that uniform heartbeat packet sending is performed.
Drawings
Fig. 1 is a schematic flowchart of a heartbeat proxy method according to an embodiment of the present application;
fig. 2 is a second schematic flowchart of a heartbeat proxy method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a heartbeat proxy apparatus provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the application may be practiced in sequences other than those illustrated or described herein, and that the terms "first," "second," and the like are generally used herein in a generic sense and do not limit the number of terms, e.g., the first term can be one or more than one. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The heartbeat proxy method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and application scenarios thereof. Fig. 1 is a schematic flow diagram of a heartbeat proxy method provided in an embodiment of the present application, and as shown in fig. 1, the heartbeat proxy method includes the following steps:
step 100, M application programs in the electronic device send a proxy request message to the heartbeat proxy module, where the proxy request message carries server addresses corresponding to the M application programs and heartbeat communication formats between the M application programs and servers corresponding to the M application programs.
Optionally, the M applications are applications with agent requirements. The M application programs with agent requirements send agent request messages to the heartbeat agent module, the heartbeat agent module is requested to act on heartbeat packet sending and receiving services of the M application programs, and meanwhile, server addresses corresponding to the application programs in the M application programs and heartbeat communication formats between the application programs and the corresponding servers are sent to the heartbeat agent module.
Optionally, the heartbeat proxy module is a section of program in a system framework layer, wherein the system framework layer is a layer between a system application layer and a system bottom layer.
It can be understood that, in the related art, in order to maintain respective long connections, the application program may occasionally send the first heartbeat packet to the server and receive the corresponding second heartbeat packet replied by the server, and in the present solution, the heartbeat proxy module is in unified charge of the heartbeat packet sending and receiving services of the application program with proxy requirements, and performs unified management on the heartbeat packet sending and receiving of each application program.
Step 101, the heartbeat proxy module stores a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program in a proxy pool.
In order to uniformly manage the sending and receiving of the heartbeat packet of the application program, the heartbeat proxy module stores the server address of the application program with proxy requirements and the heartbeat communication format between the application program and the server thereof into a proxy pool.
Optionally, after receiving the agent request message sent by the M applications, the heartbeat agent module needs to check the agent request message, and store the server address corresponding to at least one application that passes the check and the heartbeat communication format between the application that passes the check and the server corresponding to the application in the agent pool.
102, the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the network condition at the current moment.
And sending corresponding first heartbeat packets to servers corresponding to all the application programs stored in the agent pool every other target time length according to the server addresses and the heartbeat communication formats corresponding to all the application programs stored in the agent pool. The first heartbeat packet is a data packet which is sent to the server by the heartbeat proxy module and conforms to the heartbeat communication format between the corresponding application program and the server.
The first heartbeat packet may also be referred to as a ping packet.
Optionally, the target duration may be a fixed duration or a non-fixed duration, and in the case that the target duration is the non-fixed duration, the target duration may be calculated according to a network condition of the electronic device.
The proxy pool stores the server address and heartbeat communication format of at least one application program with proxy requirement, and maintains the address queue of all servers needing proxy. And the heartbeat proxy module performs unified heartbeat management on the applications according to the information in the proxy pool, wakes up the system every target time length, and sends corresponding first heartbeat packets to the servers corresponding to the application programs, wherein the corresponding first heartbeat packets conform to the heartbeat communication format between the corresponding application programs and the servers.
It should be noted that, before sending a heartbeat packet each time, the system needs to be awakened first, and therefore, in the related art, the system is always awakened, which results in high power consumption of the electronic device.
Optionally, the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to each application program through the system bottom layer every other target time length according to the server addresses and the heartbeat communication formats corresponding to all application programs stored in the proxy pool. The heartbeat proxy module sends the first heartbeat packet to the system bottom layer, and the system bottom layer transparently transmits the corresponding first heartbeat packet sent by the heartbeat proxy module to the server corresponding to each application program.
Optionally, the heartbeat proxy module obtains the network status at the current time after receiving the proxy request message sent by the M application programs, and determines the target duration according to the network status at the current time. And determining the time for waking up the system next time and sending the corresponding first heartbeat packet to the server corresponding to each application program according to the target time length.
The target time lengths corresponding to different network conditions may be the same or different.
For example, when the electronic device performs network communication based on a mobile hotspot WIFI at the current moment, the corresponding target duration is 5 minutes; at the present moment, the electronic device performs network Communication based on a fifth Generation Mobile Communication Technology (5th Generation Mobile Communication Technology, 5G), and the corresponding target duration is 10 minutes; at the present moment, the electronic device performs network Communication based on a fourth Generation Mobile Communication Technology (4th Generation Mobile Communication Technology, 4G), and the corresponding target time duration is 15 minutes; at present, the electronic device performs network Communication based on a third Generation Mobile Communication Technology (3G), and the corresponding target time duration is 20 minutes; at the present moment, the electronic device performs network Communication based on a 2th Generation Mobile Communication Technology (2G), and the corresponding target duration is 20 minutes.
And determining the target time length according to the network condition at the current moment, fully utilizing the current network resource and improving the timeliness of the heartbeat proxy.
It should be noted that, in the embodiments of the present application, all references to "systems" refer to operating systems running on electronic devices.
According to the heartbeat proxy method provided by the embodiment of the application, the proxy request message sent by the application program in the electronic equipment is received to the heartbeat proxy module, the heartbeat proxy requirements of all the application programs in the electronic equipment are integrated, the corresponding first heartbeat packet is sent to the server corresponding to the application program stored in the proxy pool every target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, and uniform heartbeat packet sending is carried out.
Optionally, after sending the corresponding first heartbeat packet to the server corresponding to the application program stored in the proxy pool, the method further includes:
the heartbeat proxy module sends a server non-response message to the first application program when a second heartbeat packet corresponding to the first application program in the proxy pool is not received and the process of the first application program is in a keep-alive state;
the second heartbeat packet is a data packet sent by the server when the server responds to the first heartbeat packet, and the server non-response message is used for indicating the first application program to perform offline processing. The second heartbeat packet may also be referred to as a pong packet.
The first application program is an application program which has an agent requirement, the heartbeat agent module sends a corresponding first heartbeat packet to a server corresponding to the first application program, and the heartbeat agent module does not receive a second heartbeat packet sent by the server corresponding to the first application program. The first application may be one of M applications or may be an application pre-stored in the proxy pool.
Optionally, the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to an application program stored in the proxy pool through the system bottom layer, and the server corresponding to the application program stored in the proxy pool responds to the first heartbeat packet and sends a second heartbeat packet to the system bottom layer. And under the condition that the heartbeat proxy module does not receive a second heartbeat packet sent by a system bottom layer and the process of the corresponding first application program is in a keep-alive state, sending a server non-response message to the first application program, wherein the process of the application program occupies the resources of the electronic equipment when the process of the application program is in the keep-alive state.
And the first application program automatically performs offline processing on the condition that the server does not respond to the message, for example, the electronic equipment resource occupied by the first application program is released, or the first application program reestablishes connection with the server side of the first application program.
According to the heartbeat proxy method provided by the embodiment of the application, under the condition that the second heartbeat packet is not received and the process of the corresponding first application program is in the keep-alive state, the server non-response message is sent to the first application program, so that the first application program can know that the server is not responsive and can timely perform offline processing.
Optionally, the storing, by the heartbeat proxy module, a server address corresponding to at least one of the M applications and a heartbeat communication format between the at least one application and its corresponding server in the proxy pool includes:
performing authorization check on the agent request messages of the M application programs;
and storing the server address corresponding to at least one application program passing the result of the authorization check and the heartbeat communication format between the at least one application program and the corresponding server thereof in an agent pool.
Optionally, the content of the authorization check includes checking whether the system blackens the proxy permissions of the M applications, for example, determining whether the M applications are in a proxy request blacklist of the system. In the case where the system blackens the proxy privilege for one of the M applications, then the authorization check for that application fails.
Optionally, the content of the authorization check further includes whether the proxy request is a malicious proxy request, for example, in a case that the proxy request message frequently switches the server address for the same application, it is determined that the proxy request is a malicious proxy request. In the case where the agent request is a malicious agent request, the authorization check does not pass.
And the heartbeat proxy module carries out authorization check on proxy request messages sent by the M application programs, and stores the server address corresponding to at least one application program passing the authorization check result and the heartbeat communication format between at least one application program and the corresponding server to the application program to a proxy pool under the condition that the proxy request message authorization check result of at least one application program passes.
According to the heartbeat proxy method provided by the embodiment of the application, before the address of the server corresponding to the application program and the heartbeat communication format between the application program and the server corresponding to the application program are stored in the proxy pool, the proxy request message sent by the application program is subjected to authorization check, so that the safety and reliability of the heartbeat proxy are improved.
Optionally, the heartbeat proxy method further includes:
and freezing the second application program in the proxy pool under the condition that the second application program exits the background.
The freezing refers to suppressing the running of the application program, and freezing all the capabilities of the process where the application program is located. The freezing module of the system can quickly freeze the application programs which are not in the keep-alive white list, so that the process in which the application programs are located loses the operation capability and even breaks the network. The difference between freezing and killing the application program is that the frozen application program still retains the resources in the memory, so that the frozen application program can be quickly recovered when being thawed, and the slow start caused by re-applying the resources is not needed.
The second application is an application with an agent requirement, the second application has sent an agent request message to the heartbeat proxy module, and the heartbeat proxy module has stored a server address corresponding to the second application and a heartbeat communication format between the second application and a server corresponding to the second application to the agent pool. The second application and the first application may be the same application or may be different applications.
Alternatively, if it is checked that the second application has exited into the background, without a background download and play task, the freezing module of the requesting system freezes the second application.
According to the heartbeat proxy method provided by the embodiment of the application, the second application program is frozen under the condition that the second application program exits from the background, so that the occupation of system resources is reduced, and the system resources are saved.
Optionally, the sending, by M applications in the electronic device, the proxy request message to the heartbeat proxy module includes:
under the condition that M application programs in the electronic equipment are successfully connected with the corresponding servers, the M application programs send agent request messages to the heartbeat proxy module by calling a first software tool development kit interface;
wherein the first software tool development kit is used for providing a method for realizing the heartbeat proxy function.
Optionally, the application with agent requirements self-integrates a first Software Development Kit (SDK).
After the application program is normally started, connection establishment with the corresponding server is tried. Each application program judges whether the connection establishment with the corresponding server is successful, and under the condition of unsuccessful connection establishment, the application program automatically determines whether the server is reconnected, and the system does not interfere in the connection process of the application program and the server.
And under the condition that the connection between the application program and the corresponding server is successful, the application program sends the agent request message to the heartbeat proxy module by calling a first software tool development kit interface.
According to the heartbeat proxy method provided by the embodiment of the application, under the condition that the application program is successfully connected with the corresponding server, the proxy request message is sent to the heartbeat proxy module by calling the first software tool development kit interface, and the proxy request message of each application program is uniformly managed through the first software tool development interface.
An embodiment of the present application provides a heartbeat proxy method, including:
the method comprises the steps that a system bottom layer receives a first heartbeat packet sent by a heartbeat proxy module, and the first heartbeat packet is transmitted to a corresponding server;
and the system bottom layer receives a second heartbeat packet sent by the target server and transparently transmits the second heartbeat packet to the heartbeat proxy module.
It should be noted that the proxy request message sent by the application program to the heartbeat proxy module includes a heartbeat communication format between the application program and the server, so that the heartbeat communication format between the application program and the server is acquired at the bottom layer of the system, data packets sent by the server are continuously received in the system operation process, whether the data packets are second heartbeat packets or not is judged according to the heartbeat communication format between the application program and the server corresponding to the received data packets, and the second heartbeat packets are transmitted to the heartbeat proxy module under the condition that the data packets are the second heartbeat packets.
Compared with the prior art that the system bottom layer directly sends the second heartbeat package to the application program, the heartbeat proxy method provided by the embodiment of the application integrates the heartbeat proxy requirements of each application program in the electronic equipment, and reduces the power consumption of the electronic equipment.
Fig. 2 is a second schematic flow chart of the heartbeat proxy method according to the embodiment of the present application, and as shown in fig. 2, the heartbeat proxy method includes:
step 200, the application program sends an agent request to the heartbeat agent module.
Optionally, an application program with an agent requirement sends an agent request to the heartbeat agent module, where the agent request message carries a server address corresponding to the application program and a heartbeat communication format between the application program and a server corresponding to the application program.
Step 201, the heartbeat proxy module performs authorization check on the proxy request message.
Optionally, the content of the authorization check includes checking whether the system blackens the proxy permission of the application program, and the content of the authorization check further includes whether the proxy request is a malicious proxy request. In the case where the system blackens the proxy permission of the application or the proxy request is a malicious proxy request, the authorization check does not pass.
Step 202, the heartbeat proxy module sends a first heartbeat packet to the system bottom layer every other target time length.
Optionally, in step 201, in the case that the authorization check passes, the heartbeat proxy module stores the address of the server corresponding to the application program and the heartbeat communication format between the application program and the server corresponding to the application program to the proxy pool. And sending corresponding first heartbeat packets to a system bottom layer every other target time length according to the server addresses and the heartbeat communication formats corresponding to all the application programs stored in the agent pool.
And 203, the system bottom layer transparently transmits the first heartbeat packet to a server corresponding to the application program.
Optionally, the system bottom layer transparently transmits the first heartbeat packet to the corresponding server when receiving the first heartbeat packet sent by the heartbeat proxy module.
And step 204, the server sends a second heartbeat packet to a system bottom layer.
Optionally, the server generates a second heartbeat packet according to a heartbeat communication format between the server and the application program when receiving the first heartbeat packet, and sends the second heartbeat packet to the system bottom layer.
And step 205, the system bottom layer transparently transmits the second heartbeat packet to the heartbeat proxy module.
Optionally, the system bottom layer receives a second heartbeat packet sent by the target server, and transparently transmits the second heartbeat packet to the heartbeat proxy module.
Step 206, the heartbeat proxy module sends a server no response message to the application.
Under the condition that the heartbeat proxy module does not receive the second heartbeat packet and the process of the corresponding application program is in a keep-alive state, the application program sends a server non-response message; and under the condition that the heartbeat proxy module receives the second heartbeat packet transparently transmitted by the system bottom layer, the server is indicated to have response, and processing is not needed at the moment.
According to the heartbeat proxy method provided by the embodiment of the application, proxy request messages sent by application programs are received, heartbeat proxy requirements of all application programs in the electronic equipment are integrated, corresponding first heartbeat packages are sent to servers corresponding to all the application programs at intervals of a target time according to server addresses and heartbeat communication formats corresponding to all the application programs stored in a proxy pool, and uniform heartbeat package sending is carried out.
It should be noted that, in the heartbeat proxy method provided in the embodiment of the present application, the execution main body may be a heartbeat proxy device, or a control module in the heartbeat proxy device, which is used for executing the heartbeat proxy method. In the embodiment of the present application, a method for executing a heartbeat proxy by a heartbeat proxy device is taken as an example to describe the heartbeat proxy device provided in the embodiment of the present application.
Fig. 3 is a schematic structural diagram of a heartbeat proxy apparatus according to an embodiment of the present application, and as shown in fig. 3, the heartbeat proxy apparatus 300 includes a first sending module 310, a storage module 320, and a second sending module 330, where,
a first sending module 310, configured to enable M applications in the electronic device to send a proxy request message to the heartbeat proxy module, where the proxy request message carries server addresses corresponding to the M applications and a heartbeat communication format between the M applications and servers corresponding to the M applications;
a storage module 320, configured to enable the heartbeat proxy module to store, to a proxy pool, a server address corresponding to at least one of the M applications and a heartbeat communication format between the at least one application and a server corresponding to the at least one application;
a second sending module 330, configured to enable the heartbeat proxy module to send, every other target time period, a corresponding first heartbeat packet to a server corresponding to the application program stored in the proxy pool according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, where the target time period is determined based on the network condition at the current time.
Optionally, the heartbeat proxy apparatus 300 further includes a third sending module, where the third sending module is configured to:
enabling the heartbeat proxy module to send a server non-response message to a first application program under the condition that a second heartbeat packet corresponding to the first application program in the proxy pool is not received and the process of the first application program is in a keep-alive state;
optionally, the storing, by the heartbeat proxy module, a server address corresponding to at least one of the M applications and a heartbeat communication format between the at least one application and a server corresponding to the at least one application to a proxy pool includes:
performing authorization check on the agent request messages of the M application programs;
and storing the server address corresponding to at least one application program passing the result of the authorization check and the heartbeat communication format between the at least one application program and the corresponding server thereof in an agent pool.
Optionally, the heartbeat proxy apparatus 300 further includes an application freezing module, configured to:
freezing a second application in the proxy pool if the second application exits the background.
Optionally, the sending, by M applications in the electronic device, an agent request message to the heartbeat proxy module includes:
under the condition that M application programs in the electronic equipment are successfully connected with corresponding servers, the M application programs send the agent request message to the heartbeat proxy module by calling a first software tool development kit interface;
wherein the first software tool development kit is used for providing a method for realizing the heartbeat proxy function.
The heartbeat proxy device in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in an electronic device. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The heartbeat proxy device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The heartbeat proxy device provided in the embodiment of the present application can implement each process implemented by the method embodiments of fig. 1 to fig. 2, and is not described here again to avoid repetition.
Optionally, as shown in fig. 4, an electronic device 400 is further provided in this embodiment of the present application, and includes a processor 401, a memory 402, and a program or an instruction stored in the memory 402 and executable on the processor 401, where the program or the instruction is executed by the processor 401 to implement each process of the heartbeat proxy method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
It should be noted that the electronic device in the embodiment of the present application includes the mobile electronic device and the non-mobile electronic device described above.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 500 includes, but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and the like.
Those skilled in the art will appreciate that the electronic device 500 may further include a power supply (e.g., a battery) for supplying power to various components, and the power supply may be logically connected to the processor 510 via a power management system, so as to implement functions of managing charging, discharging, and power consumption via the power management system. The electronic device structure shown in fig. 5 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 510 is configured to enable M applications in the electronic device to send a proxy request message to the heartbeat proxy module, where the proxy request message carries server addresses corresponding to the M applications and a heartbeat communication format between the M applications and servers corresponding to the M applications;
the heartbeat proxy module stores a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program into a proxy pool;
and the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the current network condition.
In the implementation of the application, the heartbeat proxy requirements of each application program in the electronic equipment are integrated by sending a proxy request message to the heartbeat proxy module by the application program in the electronic equipment, and a corresponding first heartbeat packet is sent to a server corresponding to the application program stored in the proxy pool at intervals of a target time according to the server addresses and the heartbeat communication formats corresponding to all applications stored in the proxy pool, so that uniform heartbeat packet sending is performed.
Optionally, the processor 510 is further configured to enable the heartbeat proxy module to send a server non-response message to the first application program when the second heartbeat packet corresponding to the first application program in the proxy pool is not received and the process of the first application program is in a keep-alive state;
the second heartbeat packet is a data packet sent by the server when the server responds to the first heartbeat packet, and the server non-response message is used for indicating the first application program to perform offline processing.
In the implementation of the application, under the condition that the second heartbeat packet is not received and the process of the corresponding first application program is in a keep-alive state, a server non-response message is sent to the first application program, so that the first application program can know that the server is non-responsive and can timely perform offline processing.
Optionally, the processor 510 is further configured to perform authorization check on the agent request messages of the M applications;
and storing the server address corresponding to at least one application program passing the result of the authorization check and the heartbeat communication format between the at least one application program and the corresponding server thereof in the proxy pool.
In the implementation of the application, before the address of the server corresponding to the application program and the heartbeat communication format between the application program and the server corresponding to the application program are stored in the proxy pool, the proxy request message sent by the application program is subjected to authorization check, so that the safety and reliability of the heartbeat proxy are improved.
Optionally, the processor 510 is further configured to freeze the second application in the proxy pool if the second application exits the background.
In the implementation of the application, the third application is frozen under the condition that the second application program exits from the background, so that the occupation of system resources is reduced, and the system resources are saved.
Optionally, the sending, by M applications in the electronic device, the proxy request message to the heartbeat proxy module includes:
under the condition that M application programs in the electronic equipment are successfully connected with the corresponding servers, the M application programs send agent request messages to the heartbeat proxy module by calling a first software tool development kit interface;
wherein the first software tool development kit is used for providing a method for realizing the heartbeat proxy function.
In the implementation of the application, when the application program is successfully connected with the corresponding server, the agent request message is sent to the heartbeat proxy module by calling the first software tool development kit interface, and the agent request message of each application program is managed in a unified manner through the first software tool development interface.
It should be understood that in the embodiment of the present application, the input Unit 504 may include a Graphics Processing Unit (GPU) 5041 and a microphone 5042, and the Graphics processor 5041 processes image data of still pictures or videos obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 507 includes a touch panel 5071 and other input devices 5072. A touch panel 5071, also referred to as a touch screen. The touch panel 5071 may include two parts of a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in further detail herein. The memory 509 may be used to store software programs as well as various data including, but not limited to, application programs and operating systems. Processor 510 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 510.
The embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the above embodiments of the heartbeat proxy method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the embodiment of the heartbeat proxy method, and can achieve the same technical effect, and in order to avoid repetition, the description is omitted here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a computer software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling an electronic device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. The heartbeat proxy method is applied to electronic equipment, and the electronic equipment comprises a heartbeat proxy module; the method comprises the following steps:
m application programs in the electronic equipment send agent request messages to the heartbeat proxy module, wherein the agent request messages carry server addresses corresponding to the M application programs and heartbeat communication formats between the M application programs and servers corresponding to the M application programs;
the heartbeat proxy module stores a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program into a proxy pool;
the heartbeat proxy module sends a corresponding first heartbeat packet to a server corresponding to an application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the network condition at the current moment;
wherein M is a positive integer.
2. The heartbeat proxy method of claim 1 further comprising, after sending the respective first heartbeat packet to the server corresponding to the application stored in the proxy pool:
the heartbeat proxy module sends a server non-response message to the first application program when a second heartbeat packet corresponding to the first application program in the proxy pool is not received and the process of the first application program is in a keep-alive state;
the second heartbeat packet is a data packet sent by the server when the server responds to the first heartbeat packet, and the server no-response message is used for indicating the first application program to perform offline processing.
3. The heartbeat proxy method of claim 1 wherein the heartbeat proxy module stores a server address corresponding to at least one of the M applications and a heartbeat communication format between the at least one application and its corresponding server in a proxy pool, comprising:
performing authorization check on the agent request messages of the M application programs;
and storing the server address corresponding to at least one application program passing the result of the authorization check and the heartbeat communication format between the at least one application program and the corresponding server thereof in a proxy pool.
4. The heartbeat proxy method of claim 1 further comprising:
freezing a second application in the proxy pool if the second application exits the background.
5. The heartbeat proxy method of claim 1 wherein the M applications in the electronic device sending proxy request messages to the heartbeat proxy module includes:
under the condition that M application programs in the electronic equipment are successfully connected with corresponding servers, the M application programs send the agent request message to the heartbeat proxy module by calling a first software tool development kit interface;
wherein the first software tool development kit is used for providing a method for realizing the heartbeat proxy function.
6. A heartbeat proxy device, comprising:
a first sending module, configured to enable M applications in the electronic device to send a proxy request message to the heartbeat proxy module, where the proxy request message carries server addresses corresponding to the M applications and a heartbeat communication format between the M applications and servers corresponding to the M applications;
the storage module is used for enabling the heartbeat proxy module to store a server address corresponding to at least one application program in the M application programs and a heartbeat communication format between the at least one application program and a server corresponding to the application program into a proxy pool;
and the second sending module is used for enabling the heartbeat proxy module to send corresponding first heartbeat packets to a server corresponding to the application program stored in the proxy pool every other target time length according to the server address and the heartbeat communication format corresponding to the application program stored in the proxy pool, wherein the target time length is determined based on the network condition at the current moment.
7. The heartbeat proxy device of claim 6 further comprising:
a third sending module, configured to enable the heartbeat proxy module to send a server non-response message to the first application program when a second heartbeat packet corresponding to the first application program in the proxy pool is not received and a process of the first application program is in a keep-alive state;
the second heartbeat packet is a data packet sent by the server when the server responds to the first heartbeat packet, and the server no-response message is used for indicating the first application program to perform offline processing.
8. The heartbeat proxy device of claim 6 wherein the heartbeat proxy module stores a server address corresponding to at least one of the M applications and a heartbeat communication format between the at least one application and its corresponding server in a proxy pool, comprising:
performing authorization check on the agent request messages of the M application programs;
and storing the server address corresponding to at least one application program passing the result of the authorization check and the heartbeat communication format between the at least one application program and the corresponding server thereof in an agent pool.
9. The heartbeat proxy device of claim 6 further comprising:
and the application freezing module is used for freezing the second application program in the proxy pool under the condition that the second application program exits the background.
10. The heartbeat proxy device of claim 6 wherein the M applications in the electronic device sending proxy request messages to the heartbeat proxy module includes:
under the condition that M application programs in the electronic equipment are successfully connected with corresponding servers, the M application programs send the agent request message to the heartbeat proxy module by calling a first software tool development kit interface;
wherein the first software tool development kit is used for providing a method for realizing the heartbeat proxy function.
CN202111300981.8A 2021-11-04 2021-11-04 Heartbeat proxy method and device Pending CN114126014A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111300981.8A CN114126014A (en) 2021-11-04 2021-11-04 Heartbeat proxy method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111300981.8A CN114126014A (en) 2021-11-04 2021-11-04 Heartbeat proxy method and device

Publications (1)

Publication Number Publication Date
CN114126014A true CN114126014A (en) 2022-03-01

Family

ID=80380536

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111300981.8A Pending CN114126014A (en) 2021-11-04 2021-11-04 Heartbeat proxy method and device

Country Status (1)

Country Link
CN (1) CN114126014A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225715A (en) * 2022-06-30 2022-10-21 深圳市云洲创新科技有限公司 Data interaction method and data interaction system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581950A (en) * 2013-11-15 2014-02-12 中国联合网络通信集团有限公司 Electronic device and heartbeat message transmitting method and system
US20140122710A1 (en) * 2011-07-01 2014-05-01 Huawei Technologies Co., Ltd Method for sending heartbeat message and heartbeat proxy server
CN103916424A (en) * 2012-12-31 2014-07-09 中国移动通信集团广东有限公司 Application program heartbeat packet control method, communication terminal and communication network
US20150331739A1 (en) * 2013-04-26 2015-11-19 Huawei Technologies Co., Ltd. Method and Apparatus for Controlling Sending of Heartbeat Signal
CN106028428A (en) * 2016-04-27 2016-10-12 努比亚技术有限公司 Information processing method and mobile terminal
CN106126305A (en) * 2016-07-05 2016-11-16 宇龙计算机通信科技(深圳)有限公司 A kind of application freezing method, device and mobile terminal
CN106941713A (en) * 2017-05-16 2017-07-11 努比亚技术有限公司 It is a kind of to reduce the method and its device of mobile terminal power consumption
CN108768763A (en) * 2018-05-04 2018-11-06 北京小米移动软件有限公司 Heartbeat message sending method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140122710A1 (en) * 2011-07-01 2014-05-01 Huawei Technologies Co., Ltd Method for sending heartbeat message and heartbeat proxy server
CN103916424A (en) * 2012-12-31 2014-07-09 中国移动通信集团广东有限公司 Application program heartbeat packet control method, communication terminal and communication network
US20150331739A1 (en) * 2013-04-26 2015-11-19 Huawei Technologies Co., Ltd. Method and Apparatus for Controlling Sending of Heartbeat Signal
CN103581950A (en) * 2013-11-15 2014-02-12 中国联合网络通信集团有限公司 Electronic device and heartbeat message transmitting method and system
CN106028428A (en) * 2016-04-27 2016-10-12 努比亚技术有限公司 Information processing method and mobile terminal
CN106126305A (en) * 2016-07-05 2016-11-16 宇龙计算机通信科技(深圳)有限公司 A kind of application freezing method, device and mobile terminal
CN106941713A (en) * 2017-05-16 2017-07-11 努比亚技术有限公司 It is a kind of to reduce the method and its device of mobile terminal power consumption
CN108768763A (en) * 2018-05-04 2018-11-06 北京小米移动软件有限公司 Heartbeat message sending method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225715A (en) * 2022-06-30 2022-10-21 深圳市云洲创新科技有限公司 Data interaction method and data interaction system
CN115225715B (en) * 2022-06-30 2024-01-26 深圳市云洲创新科技有限公司 Data interaction method and data interaction system

Similar Documents

Publication Publication Date Title
KR102185004B1 (en) Method for terminal and network device interaction and terminal
CN107749797B (en) Computing equipment and implementation method thereof
KR101877150B1 (en) Method, terminal, and system for pushing information
CN101873616B (en) Mobile terminal self-check method and system and mobile terminal
US20130124618A1 (en) Method, system and device for supporting application client being always online
CN108551668B (en) Information transmission method, device, equipment and storage medium
CN112188227A (en) Streaming media data distribution method and device
CN113038593B (en) Connection establishment method, device and user equipment
CN104102540A (en) Operation process management method and mobile terminal
CN114126014A (en) Heartbeat proxy method and device
CA3048685C (en) Parameter configuration method and equipment
US20170099636A1 (en) Method and apparatus for controlling tcp packets in communication system
CN112153032A (en) Information processing method, device, computer readable storage medium and system
CN109992363B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN114173291B (en) Data processing method and device
JP7373679B2 (en) Wi-Fi control method, device and electronic equipment
CN112866422B (en) Data request processing method and device
CN103517250B (en) The method and apparatus abnormal for handling application proxy client
CN113965915B (en) Data processing method and electronic equipment
CN113891441A (en) Network connection method and device and electronic equipment
CN113923613A (en) Call processing method and device, electronic equipment and storage medium
CN113746909A (en) Network connection method, device, electronic equipment and computer readable storage medium
JP2019149824A (en) Method and terminal for interaction between the terminal and network device
CN113824777B (en) Data management method and data management device
CN114915437B (en) Development kit authentication method and related equipment

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