WO2020211373A1 - Heartbeat packet sending method and apparatus based on intermediate server, and computer device - Google Patents

Heartbeat packet sending method and apparatus based on intermediate server, and computer device Download PDF

Info

Publication number
WO2020211373A1
WO2020211373A1 PCT/CN2019/119220 CN2019119220W WO2020211373A1 WO 2020211373 A1 WO2020211373 A1 WO 2020211373A1 CN 2019119220 W CN2019119220 W CN 2019119220W WO 2020211373 A1 WO2020211373 A1 WO 2020211373A1
Authority
WO
WIPO (PCT)
Prior art keywords
heartbeat
terminal
consumer
sending
subscription request
Prior art date
Application number
PCT/CN2019/119220
Other languages
French (fr)
Chinese (zh)
Inventor
刘一佟
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020211373A1 publication Critical patent/WO2020211373A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/562Brokering proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Definitions

  • This application relates to the field of computers, and in particular to a method, device, computer equipment and storage medium for sending heartbeat packets based on an intermediate server.
  • the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) regularly so that the two parties who need to maintain a communication connection can know exactly whether the other party is in an active state to ensure the validity of the connection.
  • the center jump state is divided into static (ie abnormal) or active (ie normal).
  • the prior art mostly adopts the form of http connection, that is, the detected party sends the heartbeat packet through the http interface, and the detecting party receives the heartbeat packet through the http interface.
  • heartbeat overhead refers to the use of heartbeat
  • the mechanism that is, the computing resources, network resources, and other expenses used to detect whether the other party is active—is not conducive to resource saving and data management. Therefore, in the prior art, there is an urgent need for a technical solution that can reduce heartbeat overhead and facilitate management when performing heartbeat detection.
  • the main purpose of this application is to provide a heartbeat packet sending method, device, computer equipment and storage medium based on an intermediate server, aiming to use the intermediate server to manage heartbeat packets uniformly, reduce heartbeat overhead, and reduce the cost of heartbeat management.
  • this application proposes a heartbeat packet sending method based on an intermediate server, which includes the following steps:
  • This application provides a heartbeat packet sending device based on an intermediate server, including:
  • a heartbeat subscription request receiving unit configured to receive a heartbeat subscription request for a designated terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information;
  • the heartbeat subscription quantity threshold judging unit is configured to count the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription quantity threshold;
  • a heartbeat packet acquisition request sending unit configured to send a heartbeat packet acquisition request to the designated terminal if the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
  • a heartbeat packet receiving unit configured to receive a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request
  • the heartbeat packet sending unit is configured to send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • the present application provides a computer device including a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of any one of the above methods when the computer readable instructions are executed.
  • the present application provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of any of the above methods are implemented.
  • the method, device, computer equipment, and storage medium for sending heartbeat packets based on the intermediate server of the present application receive a heartbeat subscription request for a specified terminal sent by a consumer terminal. If the number of consumer terminals sending the heartbeat subscription request is greater than a preset The heartbeat subscription number threshold is sent to the designated terminal to send a heartbeat packet acquisition request, and according to the time interval specified by the heartbeat detection time interval information, the heartbeat packet is sent to the consumer terminal that sent the heartbeat subscription request, namely
  • the intermediate server the consumer terminal only needs to interface with the intermediate server, and the designated terminal only needs to interface with the intermediate server, thus avoiding the traditional technology "when there are m detected parties and n detecting parties, heartbeat detection is performed When there are up to m times n communication connections, it will cause a lot of heartbeat overhead” (and this application only needs m+n communication connections), and the intermediate server can use a unified communication protocol to further save heartbeat overhead and Reduce the consumption cost of management.
  • FIG. 1 is a schematic flowchart of a heartbeat packet sending method based on an intermediate server according to an embodiment of the application;
  • FIG. 2 is a schematic block diagram of the structure of a heartbeat packet sending device based on an intermediate server according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • an embodiment of the present application provides a method for sending a heartbeat packet based on an intermediate server, including the following steps:
  • the intermediate server receives the heartbeat subscription request for the designated terminal sent by the consumer terminal, and the heartbeat subscription request carries the heartbeat detection time interval information.
  • the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) at regular intervals to let the other party know that he is still alive to ensure the validity of the connection.
  • the heartbeat state is divided into static (ie abnormal ) Or activity (ie normal).
  • the heartbeat detection in this application is to use the heartbeat packet to detect whether the designated terminal is abnormal.
  • the heartbeat packet in this embodiment may be any heartbeat packet, for example, a heartbeat packet containing information such as a timestamp, a heartbeat interval, and a service IP.
  • the consumer terminal and the designated terminal are relative terms, that is, when a terminal (or server) requires another terminal (or server) to detect the heartbeat, the certain terminal (or server) is the consumer Terminal, correspondingly, the other terminal (or server) is the designated terminal; otherwise, the certain terminal (or server) is the designated terminal, and correspondingly, the other terminal (or server) is the consumer terminal.
  • the number of consumer terminals that send the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • the heartbeat mechanism in the prior art is to perform direct heartbeat detection between a consumer terminal and a designated terminal. This kind of heartbeat detection needs to send and receive heartbeat packets through an HTTP request each time. When the number of consumer terminals is large, the heartbeat detection The overhead will make the designated terminal unbearable.
  • this embodiment counts the number of consumer terminals that send the heartbeat subscription request, and determines whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, so as to determine whether the specified terminal can tolerate If the overhead of heartbeat detection in the prior art cannot be tolerated, an intermediate server is used for transfer instead of sending heartbeat packets to different consumer terminals. If it can be tolerated, the heartbeat packet is sent and received directly through HTTP requests. can. The method for determining whether the designated terminal can tolerate the overhead of heartbeat detection in the prior art is achieved by determining whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • a heartbeat packet acquisition request is sent to the designated terminal.
  • the heartbeat packet can be transferred through the intermediate server. Accordingly, the intermediate server sends a heartbeat packet acquisition request to the designated terminal, thereby requiring the designated terminal to send a heartbeat packet.
  • receiving the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition requirement may be sent at predetermined intervals, and the predetermined time may be set by the designated terminal, or may be set by the designated terminal according to a predetermined time set by the intermediate server, or may be set by the designated terminal.
  • the designated terminal is set according to the heartbeat detection time interval information carried in the heartbeat subscription request. According to this, a heartbeat packet is received.
  • the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. Since the heartbeat subscription request sent by the consumer terminal to the specified terminal carries the heartbeat detection time interval information, that is, the consumer terminal requires the heartbeat detection time interval, so the heartbeat packet is sent according to the heartbeat detection time interval to complete the heartbeat packet send.
  • the consumer terminal receiving the heartbeat packet can complete the heartbeat detection according to the heartbeat packet to determine the status of the designated terminal (abnormal or normal), and then determine the subsequent instructions according to the status of the designated terminal (for example, if the designated terminal is abnormal, disconnect The connection with the designated terminal, or re-verify the login account, etc.).
  • this application adopts the time interval specified by the heartbeat detection time interval information from the consumer terminal.
  • the intermediate server does not need to set the time interval, thereby reducing the procedure and improving the efficiency; and the heartbeat detection time interval information set by the consumer terminal itself is more It is adapted to the consumer terminal itself, so different consumer terminals can achieve different and most appropriate time intervals, thereby making the heartbeat detection method more flexible.
  • step S2 of counting the number of consumer terminals that have sent the heartbeat subscription request, and determining whether the number of consumer terminals that have sent the heartbeat subscription request is greater than a preset heartbeat subscription number threshold the step S2 includes:
  • S201 Determine whether the designated terminal exists in a preset list of providing heartbeat services
  • the logged-in user of the consumer terminal is a privileged user, trigger the counting of the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat Steps to subscribe threshold.
  • the terminal that can provide heartbeat packets is pre-stored in the list of providing heartbeat services.
  • judging whether the logged-in user of the consumer terminal is a privileged user may be in any manner, for example, by judging whether the logged-in user of the consumer terminal exists in a preset privilege list.
  • the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services S202, including:
  • S2021 If the designated terminal exists in the preset list of providing heartbeat services, obtain the login user name of the consumer terminal;
  • the terminal corresponding to the authority level of the consumer terminal includes the designated terminal, determine that the login user of the consumer terminal is a authority user.
  • the authority of the authority user is divided into multiple levels to further realize hierarchical management. For example, for a preset user with the highest level of authority, it is allowed to subscribe heartbeat information to all servers in the preset list of providing heartbeat services; for a low-level user, it is only allowed to subscribe to some commonly used servers in the preset list of providing heartbeat services. Subscribe to heartbeat information.
  • the authority of the authority user is determined, and the login user name of the consumer terminal is searched in a pre-stored authority user list to obtain the authority level of the consumer terminal.
  • the authority user list includes the user name, authority level, and authority.
  • the terminal corresponding to the level. If the authority of the login user of the designated terminal and the consumer terminal matches (that is, the authority is sufficient), it is determined that the login user of the consumer terminal is the authority user.
  • the method includes:
  • the preset threshold of the number of heartbeat subscriptions reflects the standard value of the endurance of the heartbeat overhead of the specified terminal.
  • the number of consumer terminals sending the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, it indicates that the designated terminal can tolerate the overhead of heartbeat detection using the prior art, so the consumer terminal directly requests the designated terminal for a heartbeat packet That's it, without going through an intermediate server. Therefore, the heartbeat subscription request sent by the consumer terminal is rejected, and then the consumer terminal is sent to the consumer terminal suggesting that the heartbeat packet be directly obtained from the designated terminal.
  • the step S5 of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes:
  • S502 According to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
  • the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • a preset message middleware is used to send the heartbeat packet.
  • message middleware such as MQ message queue service (Message Queue, MQ)
  • MQ message queue service
  • the MQ interface is used for interconnection and communication. Care about the details of communication on the network. Therefore, the heartbeat packet will be queued in the message middleware, waiting to be sent to the consumer terminal.
  • consumer terminals generally need the latest heartbeat packet, they only need the latest heartbeat packet received from the message middleware (if the designated terminal sends heartbeat packets more frequently, it will appear in one of the heartbeat detection Within the time interval specified by the time interval information, multiple heartbeat packets are received) and sent to the consumer terminal to complete the heartbeat packet sending process. Further, all heartbeat packets in the message middleware can also be sent to the consumer terminal.
  • the step S5 of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes:
  • S511 According to the time interval specified by the heartbeat detection time interval information, at the first time point of sending a heartbeat packet after the current time, according to a preset heartbeat abnormality judgment rule, judge whether the designated terminal is abnormal;
  • S512 If the designated terminal is abnormal, send the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sends the heartbeat subscription request.
  • the heartbeat packet is sent.
  • the prior art generally only determines whether the heartbeat is abnormal by the terminal itself, that is, the terminal needs to receive the heartbeat packet first, and then judge whether the designated terminal is abnormal by the heartbeat packet.
  • the intermediate server first executes the process of judging whether the designated terminal is abnormal, so that whether the designated terminal is abnormal can be obtained before sending the heartbeat packet to the consumer terminal. Compared with the prior art, it is faster and saves time. Especially suitable for situations requiring high timeliness. Therefore, if the designated terminal is abnormal, the abnormal information of the designated terminal and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request. Further, the consumer terminal can use the heartbeat packet to further verify whether the judgment conclusion of the intermediate server is accurate.
  • the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time
  • the step S511 of whether it is abnormal includes:
  • the preset heartbeat abnormality judgment rule adopted in this embodiment is: whether the difference between the current time and the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information. If the difference between the current time-the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information, the designated terminal is determined to be abnormal; if the difference between the current time-the time of the last heartbeat packet reception is not greater than 2 ⁇ The time interval specified by the heartbeat detection time interval information, and it is determined that the designated terminal is normal.
  • an embodiment of the present application provides a heartbeat packet sending device based on an intermediate server, including:
  • the heartbeat subscription request receiving unit 10 is configured to receive a heartbeat subscription request for a specified terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information;
  • the heartbeat subscription quantity threshold judging unit 20 is configured to count the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription quantity threshold;
  • the heartbeat packet acquisition request sending unit 30 is configured to send a heartbeat packet acquisition request to the designated terminal if the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
  • the heartbeat packet receiving unit 40 is configured to receive the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition requirement;
  • the heartbeat packet sending unit 50 is configured to send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • the intermediate server receives a heartbeat subscription request for a designated terminal sent by a consumer terminal, and the heartbeat subscription request carries heartbeat detection time interval information.
  • the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) at regular intervals to let the other party know that he is still alive to ensure the validity of the connection.
  • the heartbeat state is divided into static (ie abnormal ) Or activity (ie normal).
  • the heartbeat detection in this application is to use the heartbeat packet to detect whether the designated terminal is abnormal.
  • the heartbeat packet in this embodiment may be any heartbeat packet, for example, a heartbeat packet containing information such as a timestamp, a heartbeat interval, and a service IP.
  • the consumer terminal refers to a terminal that consumes services of a designated terminal, that is, a terminal that interacts with the designated terminal, and the consumer terminal is, for example, any terminal such as a PC terminal or a mobile phone terminal.
  • the designated terminal refers to a terminal or a server terminal that interacts with the consumer terminal, such as a social software server, a weather information providing server, etc.
  • the heartbeat subscription request refers to a request for obtaining a heartbeat packet of a specified terminal according to the heartbeat detection time interval information.
  • the consumer terminal and the designated terminal are relative terms, that is, when a terminal (or server) requires another terminal (or server) to detect the heartbeat, the certain terminal (or server) is the consumer Terminal, correspondingly, the other terminal (or server) is the designated terminal; otherwise, the certain terminal (or server) is the designated terminal, and correspondingly, the other terminal (or server) is the consumer terminal.
  • the number of consumer terminals that send the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • the heartbeat mechanism in the prior art is to perform direct heartbeat detection between a consumer terminal and a designated terminal. This kind of heartbeat detection needs to send and receive heartbeat packets through an HTTP request each time. When the number of consumer terminals is large, the heartbeat detection The overhead will make the designated terminal unbearable.
  • this embodiment counts the number of consumer terminals that send the heartbeat subscription request, and determines whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, so as to determine whether the specified terminal can tolerate If the overhead of heartbeat detection in the prior art cannot be tolerated, an intermediate server is used for transfer instead of sending heartbeat packets to different consumer terminals. If it can be tolerated, the heartbeat packet is sent and received directly through HTTP requests. can. The method for determining whether the designated terminal can tolerate the overhead of heartbeat detection in the prior art is achieved by determining whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • a heartbeat packet acquisition request is sent to the designated terminal.
  • the heartbeat packet can be transferred through the intermediate server. Accordingly, the intermediate server sends a heartbeat packet acquisition request to the designated terminal, thereby requiring the designated terminal to send a heartbeat packet.
  • the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request is received.
  • the heartbeat packet sent by the designated terminal may be sent at predetermined intervals, and the predetermined time may be set by the designated terminal, or may be set by the designated terminal according to a predetermined time set by the intermediate server, or may be set by the designated terminal.
  • the designated terminal is set according to the heartbeat detection time interval information carried in the heartbeat subscription request. According to this, a heartbeat packet is received.
  • the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. Since the heartbeat subscription request sent by the consumer terminal to the specified terminal carries the heartbeat detection time interval information, that is, the consumer terminal requires the heartbeat detection time interval, so the heartbeat packet is sent according to the heartbeat detection time interval to complete the heartbeat packet send.
  • the consumer terminal receiving the heartbeat packet can complete the heartbeat detection according to the heartbeat packet to determine the status of the designated terminal (abnormal or normal), and then determine the subsequent instructions according to the status of the designated terminal (for example, if the designated terminal is abnormal, disconnect The connection with the designated terminal, or re-verify the login account, etc.).
  • this application adopts the time interval specified by the heartbeat detection time interval information from the consumer terminal.
  • the intermediate server does not need to set the time interval, thereby reducing the procedure and improving the efficiency; and the heartbeat detection time interval information set by the consumer terminal itself is more It is adapted to the consumer terminal itself, so different consumer terminals can achieve different and most appropriate time intervals, thereby making the heartbeat detection method more flexible.
  • the device includes:
  • a heartbeat service list judging unit for judging whether the designated terminal exists in a preset heartbeat service list
  • the authority user judging unit is configured to determine whether the login user of the consumer terminal is a authority user if the designated terminal exists in the preset heartbeat service list;
  • the triggering unit is configured to trigger the counting the number of consumer terminals that send the heartbeat subscription request if the login user of the consumer terminal is a privileged user, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than the preset number Set the threshold of the number of heartbeat subscriptions.
  • the terminal that can provide heartbeat packets is pre-stored in the list of providing heartbeat services.
  • judging whether the logged-in user of the consumer terminal is an authorized user may be in any manner, for example, by judging whether the logged-in user of the consumer terminal exists in a preset authorization list.
  • the authority user judgment unit includes:
  • the login user name obtaining module is configured to obtain the login user name of the consumer terminal if the designated terminal exists in the preset heartbeat service list;
  • the authority level learning module is used to query the login user name of the consumer terminal in the pre-stored authority user list to obtain the authority level of the consumer terminal.
  • the authority user list includes the user name, authority level and authority level correspondence Terminal
  • the terminal judgment module corresponding to the authority level is used to determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
  • the authority user determination module is configured to determine that the login user of the consumer terminal is the authority user if the terminal corresponding to the authority level of the consumer terminal includes the designated terminal.
  • the authority of the authority user is divided into multiple levels to further realize hierarchical management. For example, for a preset user with the highest level of authority, it is allowed to subscribe heartbeat information to all servers in the preset list of providing heartbeat services; for a low-level user, it is only allowed to subscribe to some commonly used servers in the preset list of providing heartbeat services. Subscribe to heartbeat information.
  • the authority of the authority user is determined, and the login user name of the consumer terminal is searched in a pre-stored authority user list to obtain the authority level of the consumer terminal.
  • the authority user list includes the user name, authority level, and authority.
  • the terminal corresponding to the level. If the authority of the login user of the designated terminal and the consumer terminal matches (that is, the authority is sufficient), it is determined that the login user of the consumer terminal is the authority user.
  • the device includes:
  • the heartbeat subscription request rejection unit is configured to reject the heartbeat subscription request sent by the consumer terminal if the number of consumer terminals sending the heartbeat subscription request is not greater than the preset heartbeat subscription number threshold;
  • the sending suggestion information unit is used to send to the consumer terminal information suggesting that the heartbeat packet be directly obtained from the designated terminal.
  • the preset threshold of the number of heartbeat subscriptions reflects the standard value of the endurance of the heartbeat overhead of the specified terminal.
  • the heartbeat packet sending unit 50 includes:
  • the message middleware delivery subunit is used to deliver the heartbeat packet to a preset message middleware
  • the heartbeat packet sending subunit is configured to send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • a preset message middleware is used to send the heartbeat packet.
  • message middleware such as MQ message queue service (Message Queue, MQ)
  • MQ message queue service
  • the MQ interface is used for interconnection and communication. Care about the details of communication on the network. Therefore, the heartbeat packet will be queued in the message middleware, waiting to be sent to the consumer terminal.
  • consumer terminals generally need the latest heartbeat packet, they only need the latest heartbeat packet received from the message middleware (if the designated terminal sends heartbeat packets more frequently, it will appear in one of the heartbeat detection Within the time interval specified by the time interval information, multiple heartbeat packets are received) and sent to the consumer terminal to complete the heartbeat packet sending process. Further, all heartbeat packets in the message middleware can also be sent to the consumer terminal.
  • the heartbeat packet sending unit 50 includes:
  • the heartbeat abnormality judgment subunit is used to judge the designated terminal according to the time interval specified by the heartbeat detection time interval information, at the first time point after the current time when the heartbeat packet is sent, and according to the preset heartbeat abnormal judgment rule Is it abnormal;
  • the abnormal information sending subunit is configured to, if the designated terminal is abnormal, send the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sent the heartbeat subscription request.
  • the heartbeat packet is sent.
  • the prior art generally only determines whether the heartbeat is abnormal by the terminal itself, that is, the terminal needs to receive the heartbeat packet first, and then judge whether the designated terminal is abnormal by the heartbeat packet.
  • the intermediate server first executes the process of judging whether the designated terminal is abnormal, so that whether the designated terminal is abnormal can be obtained before sending the heartbeat packet to the consumer terminal. Compared with the prior art, it is faster and saves time. Especially suitable for situations requiring high timeliness. Therefore, if the designated terminal is abnormal, the abnormal information of the designated terminal and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request. Further, the consumer terminal can use the heartbeat packet to further verify whether the judgment conclusion of the intermediate server is accurate.
  • the abnormal heartbeat judgment subunit includes:
  • the time interval judgment module is used to judge whether the difference between the current time and the time of the last heartbeat packet reception at the first time point after the current time when the heartbeat packet is sent according to the time interval specified by the heartbeat detection time interval information Greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information;
  • the abnormality determination module is configured to determine that the designated terminal is abnormal if the difference between the current time and the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information.
  • the preset heartbeat abnormality judgment rule adopted in this embodiment is: whether the difference between the current time and the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information. If the difference between the current time-the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information, the designated terminal is determined to be abnormal; if the difference between the current time-the time of the last heartbeat packet reception is not greater than 2 ⁇ The time interval specified by the heartbeat detection time interval information, and it is determined that the designated terminal is normal.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in the figure.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the memory provides an environment for the operation of the operating system and computer readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store the data used in the heartbeat packet sending method based on the intermediate server.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer readable instruction is executed by the processor to realize a heartbeat packet sending method based on the intermediate server.
  • the foregoing processor executes the foregoing method for sending a heartbeat packet based on an intermediate server, including the following steps: receiving a heartbeat subscription request for a specified terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information; and sending the heartbeat subscription statistics The number of consumer terminals requested, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold; if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold , Send the heartbeat packet acquisition request to the designated terminal; receive the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request; send the heartbeat packet to the time interval specified by the heartbeat detection time interval information The consumer terminal that sends the heartbeat subscription request.
  • the step before the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the step includes: determining Whether the designated terminal exists in the preset list of providing heartbeat services; if the designated terminal exists in the preset list of providing heartbeat services, determine whether the login user of the consumer terminal is a authorized user; if the consumer terminal If the login user is a privileged user, the step of counting the number of consumer terminals sending the heartbeat subscription request is triggered, and judging whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services , Including: if the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal; and obtaining the login user name of the consumer terminal in the pre-stored list of authorized users
  • the authority level of the consumer terminal, the authority user list includes the user name, authority level, and the terminal corresponding to the authority level; determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal; If the terminal corresponding to the authority level includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
  • the method includes: If the number of consumer terminals that send the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, the heartbeat subscription request sent by the consumer terminal is rejected; the consumer terminal is advised to obtain the heartbeat packet directly from the designated terminal information.
  • the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: downloading the heartbeat packet Send to a preset message middleware; according to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
  • the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: according to the heartbeat detection time The time interval specified by the interval information, at the first time point after the current time when the heartbeat packet is sent, according to the preset heartbeat abnormality judgment rules, determine whether the designated terminal is abnormal; if the designated terminal is abnormal, the designated terminal The abnormal information and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request.
  • the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time
  • the step of abnormality includes: judging whether the difference between the current time and the time of the last heartbeat packet reception at the first time point of sending a heartbeat packet after the current time according to the time interval specified by the heartbeat detection time interval information Greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information; if the difference between the current time and the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information, determine the designated terminal abnormal.
  • An embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions are stored.
  • a method for sending a heartbeat packet based on an intermediate server including the following steps: receiving a consumer terminal A sent heartbeat subscription request to a specified terminal, the heartbeat subscription request carries heartbeat detection time interval information; the number of consumer terminals that sent the heartbeat subscription request is counted, and the number of consumer terminals that sent the heartbeat subscription request is determined whether Is greater than the preset heartbeat subscription number threshold; if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, send a heartbeat packet acquisition request to the designated terminal; receive the designated terminal according to the The heartbeat packet obtains the heartbeat packet required to be sent; and sends the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  • the computer-readable storage medium is, for example, a non-volatile computer-
  • the step before the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the step includes: determining Whether the designated terminal exists in the preset list of providing heartbeat services; if the designated terminal exists in the preset list of providing heartbeat services, determine whether the login user of the consumer terminal is a authorized user; if the consumer terminal If the login user is a privileged user, the step of counting the number of consumer terminals sending the heartbeat subscription request is triggered, and judging whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
  • the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services , Including: if the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal; and obtaining the login user name of the consumer terminal in the pre-stored list of authorized users
  • the authority level of the consumer terminal, the authority user list includes the user name, authority level, and the terminal corresponding to the authority level; determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal; If the terminal corresponding to the authority level includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
  • the method includes: If the number of consumer terminals that send the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, the heartbeat subscription request sent by the consumer terminal is rejected; the consumer terminal is advised to obtain the heartbeat packet directly from the designated terminal information.
  • the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: downloading the heartbeat packet Send to a preset message middleware; according to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
  • the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: according to the heartbeat detection time The time interval specified by the interval information, at the first time point after the current time when the heartbeat packet is sent, according to the preset heartbeat abnormality judgment rules, determine whether the designated terminal is abnormal; if the designated terminal is abnormal, the designated terminal The abnormal information and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request.
  • the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time
  • the step of abnormality includes: judging whether the difference between the current time and the time of the last heartbeat packet reception at the first time point of sending a heartbeat packet after the current time according to the time interval specified by the heartbeat detection time interval information Greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information; if the difference between the current time and the time of the last heartbeat packet reception is greater than 2 ⁇ the time interval specified by the heartbeat detection time interval information, determine the designated terminal abnormal.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A heartbeat packet sending method and apparatus based on an intermediate server, a computer device, and a storage medium. The method comprises: receiving a heartbeat subscription request sent by a consumer terminal for an appointed terminal, the heartbeat subscription request carrying heartbeat detection time interval information; counting the number of the consumer terminals sending the heartbeat subscription requests, and determining whether the number of the consumer terminals sending the heartbeat subscription requests is greater than a preset heartbeat subscription number threshold; if the number of the consumer terminals sending the heartbeat subscription requests is greater than the preset heartbeat subscription number threshold, sending a heartbeat packet acquisition request to the appointed terminal; receiving a heartbeat packet sent by the appointed terminal according to the heartbeat packet acquisition request; and sending the heartbeat packet to the consumer terminal sending the heartbeat subscription request according to a time interval specified by the heartbeat detection time interval information. Therefore, the heartbeat packets are managed in a unified mode by the intermediate server, thereby reducing heartbeat overheads and heartbeat management consumption costs.

Description

基于中间服务器的心跳包发送方法、装置和计算机设备Heartbeat packet sending method, device and computer equipment based on intermediate server
本申请要求于2019年4月19日提交中国专利局、申请号为2019103190439,发明名称为“基于中间服务器的心跳包发送方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 19, 2019, the application number is 2019103190439, and the invention title is "Intermediate server-based heartbeat packet sending method, device and computer equipment", the entire content of which is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及到计算机领域,特别是涉及到一种基于中间服务器的心跳包发送方法、装置、计算机设备和存储介质。This application relates to the field of computers, and in particular to a method, device, computer equipment and storage medium for sending heartbeat packets based on an intermediate server.
背景技术Background technique
在网络信息传输中,心跳机制是定时发送一个自定义的结构体(心跳包,心跳信息),使需要保持通信连接的双方能确切得知对方是否处于活跃状态,以确保连接的有效性的机制,其中心跳状态分为静止(即异常)或者活动(即正常)。现有技术多采用http连接的形式,即被检测方通过http接口发送心跳包,检测方通过http接口接收心跳包。在这种现有技术下,当存在多个被检测方与多个检测方时,进行心跳检测时会存在多个http连接,因此会造成大量的心跳开销(其中,心跳开销即是指采用心跳机制-即用于探知对方是否处于活跃状态-时花费的计算资源、网络资源等开销),不利于资源节省,不利于数据管理。因此现有技术亟需一种能够实现进行心跳检测时减少心跳开销、便于管理的技术方案。In network information transmission, the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) regularly so that the two parties who need to maintain a communication connection can know exactly whether the other party is in an active state to ensure the validity of the connection. , The center jump state is divided into static (ie abnormal) or active (ie normal). The prior art mostly adopts the form of http connection, that is, the detected party sends the heartbeat packet through the http interface, and the detecting party receives the heartbeat packet through the http interface. In this prior art, when there are multiple detected parties and multiple detecting parties, there will be multiple http connections during heartbeat detection, which will cause a lot of heartbeat overhead (where the heartbeat overhead refers to the use of heartbeat The mechanism—that is, the computing resources, network resources, and other expenses used to detect whether the other party is active—is not conducive to resource saving and data management. Therefore, in the prior art, there is an urgent need for a technical solution that can reduce heartbeat overhead and facilitate management when performing heartbeat detection.
技术问题technical problem
本申请的主要目的为提供一种基于中间服务器的心跳包发送方法、装置、计算机设备和存储介质,旨在利用中间服务器统一管理心跳包,减少心跳开销,减少心跳管理的消耗成本。The main purpose of this application is to provide a heartbeat packet sending method, device, computer equipment and storage medium based on an intermediate server, aiming to use the intermediate server to manage heartbeat packets uniformly, reduce heartbeat overhead, and reduce the cost of heartbeat management.
技术解决方案Technical solutions
为了实现上述目的,本申请提出一种基于中间服务器的心跳包发送方法,包括以下步骤:In order to achieve the above objective, this application proposes a heartbeat packet sending method based on an intermediate server, which includes the following steps:
接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;Receiving a heartbeat subscription request for a designated terminal sent by a consumer terminal, where the heartbeat subscription request carries heartbeat detection time interval information;
统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;Count the number of consumer terminals that send the heartbeat subscription request, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;If the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, sending a heartbeat packet acquisition request to the designated terminal;
接收所述指定终端根据所述心跳包获取要求发送的心跳包;Receiving a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。Send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
本申请提供一种基于中间服务器的心跳包发送装置,包括:This application provides a heartbeat packet sending device based on an intermediate server, including:
心跳订阅请求接收单元,用于接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;A heartbeat subscription request receiving unit, configured to receive a heartbeat subscription request for a designated terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information;
心跳订阅数量阈值判断单元,用于统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;The heartbeat subscription quantity threshold judging unit is configured to count the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription quantity threshold;
心跳包获取要求发送单元,用于若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;A heartbeat packet acquisition request sending unit, configured to send a heartbeat packet acquisition request to the designated terminal if the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
心跳包接收单元,用于接收所述指定终端根据所述心跳包获取要求发送的心跳包;A heartbeat packet receiving unit, configured to receive a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
心跳包发送单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The heartbeat packet sending unit is configured to send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
本申请提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现上述任一项所述方法的步骤。The present application provides a computer device including a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of any one of the above methods when the computer readable instructions are executed.
本申请提供一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述任一项所述的方法的步骤。The present application provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of any of the above methods are implemented.
有益效果Beneficial effect
本申请的基于中间服务器的心跳包发送方法、装置、计算机设备和存储介质,通过接收消费终端发送的对指定终端的心跳订阅请求,若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求,根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端,即利用中间服务器的方式,使消费终端仅需与中间服务器对接、而指定终端也仅需与中间服务器对接,从而避免了传统技术“当存在m个被检测方与n个检测方时,进行心跳检测时会存在高达m乘以n个通信连接,因此会造成大量的心跳开销”(而本申请仅需要m+n个通信连接),并且中间服务器可以采用统一通信协议,从而更进一步节省心跳开销并且减少管理的消耗成本。The method, device, computer equipment, and storage medium for sending heartbeat packets based on the intermediate server of the present application receive a heartbeat subscription request for a specified terminal sent by a consumer terminal. If the number of consumer terminals sending the heartbeat subscription request is greater than a preset The heartbeat subscription number threshold is sent to the designated terminal to send a heartbeat packet acquisition request, and according to the time interval specified by the heartbeat detection time interval information, the heartbeat packet is sent to the consumer terminal that sent the heartbeat subscription request, namely By using the intermediate server, the consumer terminal only needs to interface with the intermediate server, and the designated terminal only needs to interface with the intermediate server, thus avoiding the traditional technology "when there are m detected parties and n detecting parties, heartbeat detection is performed When there are up to m times n communication connections, it will cause a lot of heartbeat overhead” (and this application only needs m+n communication connections), and the intermediate server can use a unified communication protocol to further save heartbeat overhead and Reduce the consumption cost of management.
附图说明Description of the drawings
图1 为本申请一实施例的基于中间服务器的心跳包发送方法的流程示意图;FIG. 1 is a schematic flowchart of a heartbeat packet sending method based on an intermediate server according to an embodiment of the application;
图2 为本申请一实施例的基于中间服务器的心跳包发送装置的结构示意框图;2 is a schematic block diagram of the structure of a heartbeat packet sending device based on an intermediate server according to an embodiment of the application;
图3 为本申请一实施例的计算机设备的结构示意框图。FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
本发明的最佳实施方式The best mode of the invention
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the application, and not used to limit the application.
参照图1,本申请实施例提供一种基于中间服务器的心跳包发送方法,包括以下步骤:1, an embodiment of the present application provides a method for sending a heartbeat packet based on an intermediate server, including the following steps:
S1、接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;S1. Receive a heartbeat subscription request for a designated terminal sent by a consumer terminal, where the heartbeat subscription request carries heartbeat detection time interval information;
S2、统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;S2. Count the number of consumer terminals that send the heartbeat subscription request, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
S3、若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;S3. If the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, send a heartbeat packet acquisition request to the designated terminal;
S4、接收所述指定终端根据所述心跳包获取要求发送的心跳包;S4. Receive a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
S5、根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。S5. Send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
如上述步骤S1所述,中间服务器接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息。在网络信息传输中,心跳机制是定时发送一个自定义的结构体(心跳包,心跳信息),让对方知道自己还活着,以确保连接的有效性的机制,其中心跳状态分为静止(即异常)或者活动(即正常)。本申请的心跳检测即是利用心跳包来检测指定终端是否异常。本实施方式中的心跳包可以为任意心跳包,例如包中包括有时间戳、心跳间隔、服务IP等信息的心跳包。所述消费终端指消费指定终端的服务的终端,即指与所述指定终端存在信息交互的终端,所述消费终端例如为PC终端、手机终端等任意终端。所述指定终端指与所述消费终端存在信息交互的终端或者服务器终器,例如社交软件服务器、天气信息提供服务器等。所述心跳订阅请求指根据心跳检测时间间隔信息获取指定终端的心跳包的请求。其中,所述消费终端与所述指定终端是相对而言的,即当某一终端(或者服务器)要求另一终端(或者服务器)心跳检测时,所述某一终端(或者服务器)即为消费终端,相应的,所述另一终端(或者服务器)即为指定终端;反之,所述某一终端(或者服务器)即为指定终端,相应的,所述另一终端(或者服务器)即为消费终端。As described in step S1 above, the intermediate server receives the heartbeat subscription request for the designated terminal sent by the consumer terminal, and the heartbeat subscription request carries the heartbeat detection time interval information. In the network information transmission, the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) at regular intervals to let the other party know that he is still alive to ensure the validity of the connection. The heartbeat state is divided into static (ie abnormal ) Or activity (ie normal). The heartbeat detection in this application is to use the heartbeat packet to detect whether the designated terminal is abnormal. The heartbeat packet in this embodiment may be any heartbeat packet, for example, a heartbeat packet containing information such as a timestamp, a heartbeat interval, and a service IP. The consumer terminal refers to a terminal that consumes services of a designated terminal, that is, a terminal that interacts with the designated terminal, and the consumer terminal is, for example, any terminal such as a PC terminal or a mobile phone terminal. The designated terminal refers to a terminal or a server terminal that interacts with the consumer terminal, such as a social software server, a weather information providing server, etc. The heartbeat subscription request refers to a request for obtaining a heartbeat packet of a specified terminal according to the heartbeat detection time interval information. Wherein, the consumer terminal and the designated terminal are relative terms, that is, when a terminal (or server) requires another terminal (or server) to detect the heartbeat, the certain terminal (or server) is the consumer Terminal, correspondingly, the other terminal (or server) is the designated terminal; otherwise, the certain terminal (or server) is the designated terminal, and correspondingly, the other terminal (or server) is the consumer terminal.
如上述步骤S2所述,统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值。现有技术中的心跳机制是消费终端与指定终端之间进行直接心跳检测,这种心跳检测每次均需要通过http请求来完成心跳包的发送与接收,当消费终端的数量很多时,心跳检测的开销会使指定终端难以忍受。因此本实施方式通过统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值,从而确定所述指定终端是否能够忍受现有技术的心跳检测的开销,若不能忍受,则利用中间服务器中转,而不必针对不同的消费终端分别发送心跳包,若能忍受,则直接采用通过http请求来完成心跳包的发送与接收即可。其中,判断所述指定终端是否能够忍受现有技术的心跳检测的开销的方式是通过判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值来实现。As described in step S2, the number of consumer terminals that send the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold. The heartbeat mechanism in the prior art is to perform direct heartbeat detection between a consumer terminal and a designated terminal. This kind of heartbeat detection needs to send and receive heartbeat packets through an HTTP request each time. When the number of consumer terminals is large, the heartbeat detection The overhead will make the designated terminal unbearable. Therefore, this embodiment counts the number of consumer terminals that send the heartbeat subscription request, and determines whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, so as to determine whether the specified terminal can tolerate If the overhead of heartbeat detection in the prior art cannot be tolerated, an intermediate server is used for transfer instead of sending heartbeat packets to different consumer terminals. If it can be tolerated, the heartbeat packet is sent and received directly through HTTP requests. can. The method for determining whether the designated terminal can tolerate the overhead of heartbeat detection in the prior art is achieved by determining whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
如上述步骤S3所述,若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求。如前述,可知若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,表明所述指定终端不能忍受现有技术的心跳检测的开销,那么可以通过中间服务器中转心跳包。据此,中间服务器向所述指定终端发送心跳包获取要求,从而要求所述指定终端发送心跳包。As described in step S3 above, if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, a heartbeat packet acquisition request is sent to the designated terminal. As mentioned above, it can be seen that if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, indicating that the specified terminal cannot tolerate the overhead of heartbeat detection in the prior art, the heartbeat packet can be transferred through the intermediate server. Accordingly, the intermediate server sends a heartbeat packet acquisition request to the designated terminal, thereby requiring the designated terminal to send a heartbeat packet.
如上述步骤S4所述,接收所述指定终端根据所述心跳包获取要求发送的心跳包。指定终端发送的心跳包可以是间隔预定时间发送,所述预定时间可以由所述指定终端设置,或者可以由所述指定终端根据所述中间服务器的要求设置的预定时间而设置,或者可以由所述指定终端根据所述心跳订阅请求携带的心跳检测时间间隔信息而设置。据此,接收到心跳包。As described in step S4 above, receiving the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition requirement. The heartbeat packet sent by the designated terminal may be sent at predetermined intervals, and the predetermined time may be set by the designated terminal, or may be set by the designated terminal according to a predetermined time set by the intermediate server, or may be set by the designated terminal. The designated terminal is set according to the heartbeat detection time interval information carried in the heartbeat subscription request. According to this, a heartbeat packet is received.
如上述步骤S5所述,根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。由于消费终端发送的对指定终端的心跳订阅请求中携带有心跳检测时间间隔信息,即消费终端要求了心跳检测时间间隔,因此将心跳包依照所述心跳检测时间间隔进行发送,即可完成心跳包发送。而接收心跳包的消费终端根据所述心跳包,即可完成心跳检测,以确定指定终端的状态(异常或是正常),再根据指定终端的状态决定后续指令(例如指定终端异常,则断开所述与指定终端的连接,或者再次验证登陆帐号等)。并且本申请采用来自于消费终端的心跳检测时间间隔信息规定的时间间隔,首先使中间服务器不必设置时间间隔从而减少了步骤流程,提高了效率;并且由于消费终端自身设置的心跳检测时间间隔信息更适应于消费终端自身,因此不同的消费终端能够实现不同的并且最妥帖的时间时隔,从而使心跳检测的方式更加灵活。As described in step S5 above, the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. Since the heartbeat subscription request sent by the consumer terminal to the specified terminal carries the heartbeat detection time interval information, that is, the consumer terminal requires the heartbeat detection time interval, so the heartbeat packet is sent according to the heartbeat detection time interval to complete the heartbeat packet send. The consumer terminal receiving the heartbeat packet can complete the heartbeat detection according to the heartbeat packet to determine the status of the designated terminal (abnormal or normal), and then determine the subsequent instructions according to the status of the designated terminal (for example, if the designated terminal is abnormal, disconnect The connection with the designated terminal, or re-verify the login account, etc.). In addition, this application adopts the time interval specified by the heartbeat detection time interval information from the consumer terminal. First, the intermediate server does not need to set the time interval, thereby reducing the procedure and improving the efficiency; and the heartbeat detection time interval information set by the consumer terminal itself is more It is adapted to the consumer terminal itself, so different consumer terminals can achieve different and most appropriate time intervals, thereby making the heartbeat detection method more flexible.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤S2之前,包括:In one embodiment, before step S2 of counting the number of consumer terminals that have sent the heartbeat subscription request, and determining whether the number of consumer terminals that have sent the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the step S2 includes:
S201、判断所述指定终端是否存在于预设的提供心跳服务列表中;S201: Determine whether the designated terminal exists in a preset list of providing heartbeat services;
S202、若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;S202: If the designated terminal exists in the preset list of providing heartbeat services, determine whether the login user of the consumer terminal is a authorized user;
S203、若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。S203. If the logged-in user of the consumer terminal is a privileged user, trigger the counting of the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat Steps to subscribe threshold.
如上所述,实现了判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值。本实施方式通过判断所述指定终端是否存在于预设的提供心跳服务列表中,从而判断是否能够与所述指定终端实现心跳信息交互,再将消费终端分为有权限和没权限两类,只允许有权限的消费终端订阅心跳,从而实现分级化管理,也能降低中间服务器的压力。其中,提供心跳服务列表中预存了能够提供心跳包的终端。其中,判断所述消费终端的登陆用户是否为权限用户可以为任意方式,例如通过判断所述消费终端的登陆用户是否存在于预设的权限列表中。As described above, it is possible to determine whether the number of consumer terminals that send the heartbeat subscription request is greater than the preset threshold for the number of heartbeat subscriptions. In this embodiment, by judging whether the designated terminal exists in the preset list of providing heartbeat services, it is judged whether it can realize heartbeat information interaction with the designated terminal, and then the consumer terminals are divided into two types, authorized and non-authorized. Allow authorized consumer terminals to subscribe to the heartbeat, thereby achieving hierarchical management and reducing the pressure on the intermediate server. Among them, the terminal that can provide heartbeat packets is pre-stored in the list of providing heartbeat services. Wherein, judging whether the logged-in user of the consumer terminal is a privileged user may be in any manner, for example, by judging whether the logged-in user of the consumer terminal exists in a preset privilege list.
在一个实施方式中,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤S202,包括:In one embodiment, the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services S202, including:
S2021、若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;S2021: If the designated terminal exists in the preset list of providing heartbeat services, obtain the login user name of the consumer terminal;
S2022、通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;S2022. Obtain the authority level of the consumer terminal by querying the login user name of the consumer terminal in the pre-stored authority user list, where the authority user list includes the user name, the authority level, and the terminal corresponding to the authority level;
S2023、判断所述消费终端的权限级别对应的终端是否包括所述指定终端;S2023: Determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
S2024、若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。S2024. If the terminal corresponding to the authority level of the consumer terminal includes the designated terminal, determine that the login user of the consumer terminal is a authority user.
如上所述,实现了判断所述消费终端的登陆用户是否为权限用户。本实施方式将权限用户的权限分为多个级别,进一步实现分级管理。例如对于预设的最高级权限用户,允许其对预设的提供心跳服务列表中的所有服务器订阅心跳信息;对于低级权限用户,只允许其对预设的提供心跳服务列表中的常用的部分服务器订阅心跳信息。其中确定所述权限用户的权限,通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端。若所述指定终端与所述消费终端的登陆用户的权限匹配(即权限足够),则判定所述消费终端的登陆用户为权限用户。As mentioned above, it is possible to determine whether the login user of the consumer terminal is a privileged user. In this embodiment, the authority of the authority user is divided into multiple levels to further realize hierarchical management. For example, for a preset user with the highest level of authority, it is allowed to subscribe heartbeat information to all servers in the preset list of providing heartbeat services; for a low-level user, it is only allowed to subscribe to some commonly used servers in the preset list of providing heartbeat services. Subscribe to heartbeat information. The authority of the authority user is determined, and the login user name of the consumer terminal is searched in a pre-stored authority user list to obtain the authority level of the consumer terminal. The authority user list includes the user name, authority level, and authority. The terminal corresponding to the level. If the authority of the login user of the designated terminal and the consumer terminal matches (that is, the authority is sufficient), it is determined that the login user of the consumer terminal is the authority user.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤S2之后,包括:In one embodiment, after the step S2 of counting the number of consumer terminals sending the heartbeat subscription request and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the method includes:
S21、若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;S21: If the number of consumer terminals sending the heartbeat subscription request is not greater than the preset heartbeat subscription number threshold, reject the heartbeat subscription request sent by the consumer terminal;
S22、向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。S22. Send to the consumer terminal information suggesting to directly obtain the heartbeat packet from the designated terminal.
如上所述,实现了拒绝所述消费终端发送的心跳订阅请求。预设的心跳订阅数量阈值反应了指定终端对于心跳开销的忍受标准值。当发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值时,表明所述指定终端可以忍受采用现有技术的心跳检测的开销,因此消费终端直接向指定终端要求心跳包即可,无需通过中间服务器。因此拒绝所述消费终端发送的心跳订阅请求,然后向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。As described above, it is realized that the heartbeat subscription request sent by the consumer terminal is rejected. The preset threshold of the number of heartbeat subscriptions reflects the standard value of the endurance of the heartbeat overhead of the specified terminal. When the number of consumer terminals sending the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, it indicates that the designated terminal can tolerate the overhead of heartbeat detection using the prior art, so the consumer terminal directly requests the designated terminal for a heartbeat packet That's it, without going through an intermediate server. Therefore, the heartbeat subscription request sent by the consumer terminal is rejected, and then the consumer terminal is sent to the consumer terminal suggesting that the heartbeat packet be directly obtained from the designated terminal.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤S5,包括:In one embodiment, the step S5 of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes:
S501、将所述心跳包下发至预设的消息中间件;S501. Deliver the heartbeat packet to a preset message middleware;
S502、根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。S502: According to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
如上所述,实现了根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。本实施方式中利用预设的消息中间件发送心跳包。其中消息中间件(例如MQ消息队列服务(Message Queue,简称 MQ))是一种可部署于服务器的应用,用于保证异构应用之间的消息传递,通过MQ接口进行互连通信,可以不必关心网络上的通信细节。因此心跳包会在消息中间件中进行排队,等待被发送给消费终端。由于消费终端一般需要的是最新的心跳包,因此只需从所述消息中间件中最近一次接收到的心跳包(若指定终端发送心跳包的频率较高,则会出现在一个所述心跳检测时间间隔信息规定的时间间隔内,接收到多个心跳包的情况)发送给所述消费终端,即可完成心跳包发送过程。进一步地,还可以将所述消息中间件中的所有心跳包均发送给消费终端。As described above, the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. In this embodiment, a preset message middleware is used to send the heartbeat packet. Among them, message middleware (such as MQ message queue service (Message Queue, MQ)) is an application that can be deployed on the server to ensure message transfer between heterogeneous applications. The MQ interface is used for interconnection and communication. Care about the details of communication on the network. Therefore, the heartbeat packet will be queued in the message middleware, waiting to be sent to the consumer terminal. Since consumer terminals generally need the latest heartbeat packet, they only need the latest heartbeat packet received from the message middleware (if the designated terminal sends heartbeat packets more frequently, it will appear in one of the heartbeat detection Within the time interval specified by the time interval information, multiple heartbeat packets are received) and sent to the consumer terminal to complete the heartbeat packet sending process. Further, all heartbeat packets in the message middleware can also be sent to the consumer terminal.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤S5,包括:In one embodiment, the step S5 of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes:
S511、根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;S511: According to the time interval specified by the heartbeat detection time interval information, at the first time point of sending a heartbeat packet after the current time, according to a preset heartbeat abnormality judgment rule, judge whether the designated terminal is abnormal;
S512、若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。S512: If the designated terminal is abnormal, send the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sends the heartbeat subscription request.
如上所述,实现了发送心跳包。现有技术一般只由终端本身进行判断心跳是否异常,即需要终端先接收心跳包,再借由心跳包判断指定终端是否异常。本实施方式却是先由中间服务器执行判断所述指定终端是否异常的流程,从而在发送心跳包给消费终端前即可得到指定终端是否异常,相较于现有技术,更加快捷,节省时间,尤其适宜时效性要求高的情境。因此,若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。进一步地,所述消费终端还能利用心跳包进一步核实中间服务器的判断结论是否准确。As mentioned above, the heartbeat packet is sent. The prior art generally only determines whether the heartbeat is abnormal by the terminal itself, that is, the terminal needs to receive the heartbeat packet first, and then judge whether the designated terminal is abnormal by the heartbeat packet. In this embodiment, the intermediate server first executes the process of judging whether the designated terminal is abnormal, so that whether the designated terminal is abnormal can be obtained before sending the heartbeat packet to the consumer terminal. Compared with the prior art, it is faster and saves time. Especially suitable for situations requiring high timeliness. Therefore, if the designated terminal is abnormal, the abnormal information of the designated terminal and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request. Further, the consumer terminal can use the heartbeat packet to further verify whether the judgment conclusion of the intermediate server is accurate.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常的步骤S511,包括:In one embodiment, according to the time interval specified by the heartbeat detection time interval information, the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time The step S511 of whether it is abnormal includes:
S5111、根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,判断当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔;S5111, according to the time interval specified by the heartbeat detection time interval information, at the first time point of sending a heartbeat packet after the current time, determine whether the difference between the current time and the time of the last heartbeat packet reception is greater than 2×the The time interval specified by the heartbeat detection time interval information;
S5112、若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,则判定所述指定终端异常。S5112, if the difference between the current time and the time of the last heartbeat packet reception is greater than 2× the time interval specified by the heartbeat detection time interval information, determine that the designated terminal is abnormal.
如上所述,实现了根据预设的心跳异常判断规则,判断所述指定终端是否异常。本实施方式采用的预设的心跳异常判断规则为:当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔。若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,判定指定终端异常;若当前时间-最后一次接收心跳包的时间的差值不大于2×所述心跳检测时间间隔信息规定的时间间隔,判定指定终端正常。As described above, it is realized whether the designated terminal is abnormal according to the preset heartbeat abnormality judgment rule. The preset heartbeat abnormality judgment rule adopted in this embodiment is: whether the difference between the current time and the time of the last heartbeat packet reception is greater than 2×the time interval specified by the heartbeat detection time interval information. If the difference between the current time-the time of the last heartbeat packet reception is greater than 2 × the time interval specified by the heartbeat detection time interval information, the designated terminal is determined to be abnormal; if the difference between the current time-the time of the last heartbeat packet reception is not greater than 2×The time interval specified by the heartbeat detection time interval information, and it is determined that the designated terminal is normal.
参照图2,本申请实施例提供一种基于中间服务器的心跳包发送装置,包括:2, an embodiment of the present application provides a heartbeat packet sending device based on an intermediate server, including:
心跳订阅请求接收单元10,用于接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;The heartbeat subscription request receiving unit 10 is configured to receive a heartbeat subscription request for a specified terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information;
心跳订阅数量阈值判断单元20,用于统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;The heartbeat subscription quantity threshold judging unit 20 is configured to count the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription quantity threshold;
心跳包获取要求发送单元30,用于若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;The heartbeat packet acquisition request sending unit 30 is configured to send a heartbeat packet acquisition request to the designated terminal if the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
心跳包接收单元40,用于接收所述指定终端根据所述心跳包获取要求发送的心跳包;The heartbeat packet receiving unit 40 is configured to receive the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition requirement;
心跳包发送单元50,用于根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The heartbeat packet sending unit 50 is configured to send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
如上述单元10所述,中间服务器接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息。在网络信息传输中,心跳机制是定时发送一个自定义的结构体(心跳包,心跳信息),让对方知道自己还活着,以确保连接的有效性的机制,其中心跳状态分为静止(即异常)或者活动(即正常)。本申请的心跳检测即是利用心跳包来检测指定终端是否异常。本实施方式中的心跳包可以为任意心跳包,例如包中包括有时间戳、心跳间隔、服务IP等信息的心跳包。所述消费终端指消费指定终端的服务的终端,即指与所述指定终端存在信息交互的终端,所述消费终端例如为PC终端、手机终端等任意终端。所述指定终端指与所述消费终端存在信息交互的终端或者服务器终器,例如社交软件服务器、天气信息提供服务器等。所述心跳订阅请求指根据心跳检测时间间隔信息获取指定终端的心跳包的请求。其中,所述消费终端与所述指定终端是相对而言的,即当某一终端(或者服务器)要求另一终端(或者服务器)心跳检测时,所述某一终端(或者服务器)即为消费终端,相应的,所述另一终端(或者服务器)即为指定终端;反之,所述某一终端(或者服务器)即为指定终端,相应的,所述另一终端(或者服务器)即为消费终端。As described in the foregoing unit 10, the intermediate server receives a heartbeat subscription request for a designated terminal sent by a consumer terminal, and the heartbeat subscription request carries heartbeat detection time interval information. In the network information transmission, the heartbeat mechanism is to send a custom structure (heartbeat packet, heartbeat information) at regular intervals to let the other party know that he is still alive to ensure the validity of the connection. The heartbeat state is divided into static (ie abnormal ) Or activity (ie normal). The heartbeat detection in this application is to use the heartbeat packet to detect whether the designated terminal is abnormal. The heartbeat packet in this embodiment may be any heartbeat packet, for example, a heartbeat packet containing information such as a timestamp, a heartbeat interval, and a service IP. The consumer terminal refers to a terminal that consumes services of a designated terminal, that is, a terminal that interacts with the designated terminal, and the consumer terminal is, for example, any terminal such as a PC terminal or a mobile phone terminal. The designated terminal refers to a terminal or a server terminal that interacts with the consumer terminal, such as a social software server, a weather information providing server, etc. The heartbeat subscription request refers to a request for obtaining a heartbeat packet of a specified terminal according to the heartbeat detection time interval information. Wherein, the consumer terminal and the designated terminal are relative terms, that is, when a terminal (or server) requires another terminal (or server) to detect the heartbeat, the certain terminal (or server) is the consumer Terminal, correspondingly, the other terminal (or server) is the designated terminal; otherwise, the certain terminal (or server) is the designated terminal, and correspondingly, the other terminal (or server) is the consumer terminal.
如上述单元20所述,统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值。现有技术中的心跳机制是消费终端与指定终端之间进行直接心跳检测,这种心跳检测每次均需要通过http请求来完成心跳包的发送与接收,当消费终端的数量很多时,心跳检测的开销会使指定终端难以忍受。因此本实施方式通过统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值,从而确定所述指定终端是否能够忍受现有技术的心跳检测的开销,若不能忍受,则利用中间服务器中转,而不必针对不同的消费终端分别发送心跳包,若能忍受,则直接采用通过http请求来完成心跳包的发送与接收即可。其中,判断所述指定终端是否能够忍受现有技术的心跳检测的开销的方式是通过判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值来实现。As described in the aforementioned unit 20, the number of consumer terminals that send the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold. The heartbeat mechanism in the prior art is to perform direct heartbeat detection between a consumer terminal and a designated terminal. This kind of heartbeat detection needs to send and receive heartbeat packets through an HTTP request each time. When the number of consumer terminals is large, the heartbeat detection The overhead will make the designated terminal unbearable. Therefore, this embodiment counts the number of consumer terminals that send the heartbeat subscription request, and determines whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, so as to determine whether the specified terminal can tolerate If the overhead of heartbeat detection in the prior art cannot be tolerated, an intermediate server is used for transfer instead of sending heartbeat packets to different consumer terminals. If it can be tolerated, the heartbeat packet is sent and received directly through HTTP requests. can. The method for determining whether the designated terminal can tolerate the overhead of heartbeat detection in the prior art is achieved by determining whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
如上述单元30所述,若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求。如前述,可知若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,表明所述指定终端不能忍受现有技术的心跳检测的开销,那么可以通过中间服务器中转心跳包。据此,中间服务器向所述指定终端发送心跳包获取要求,从而要求所述指定终端发送心跳包。As described in the foregoing unit 30, if the number of consumer terminals that send the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, a heartbeat packet acquisition request is sent to the designated terminal. As mentioned above, it can be seen that if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, indicating that the specified terminal cannot tolerate the overhead of heartbeat detection in the prior art, the heartbeat packet can be transferred through the intermediate server. Accordingly, the intermediate server sends a heartbeat packet acquisition request to the designated terminal, thereby requiring the designated terminal to send a heartbeat packet.
如上述单元40所述,接收所述指定终端根据所述心跳包获取要求发送的心跳包。指定终端发送的心跳包可以是间隔预定时间发送,所述预定时间可以由所述指定终端设置,或者可以由所述指定终端根据所述中间服务器的要求设置的预定时间而设置,或者可以由所述指定终端根据所述心跳订阅请求携带的心跳检测时间间隔信息而设置。据此,接收到心跳包。As described in the foregoing unit 40, the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request is received. The heartbeat packet sent by the designated terminal may be sent at predetermined intervals, and the predetermined time may be set by the designated terminal, or may be set by the designated terminal according to a predetermined time set by the intermediate server, or may be set by the designated terminal. The designated terminal is set according to the heartbeat detection time interval information carried in the heartbeat subscription request. According to this, a heartbeat packet is received.
如上述单元50所述,根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。由于消费终端发送的对指定终端的心跳订阅请求中携带有心跳检测时间间隔信息,即消费终端要求了心跳检测时间间隔,因此将心跳包依照所述心跳检测时间间隔进行发送,即可完成心跳包发送。而接收心跳包的消费终端根据所述心跳包,即可完成心跳检测,以确定指定终端的状态(异常或是正常),再根据指定终端的状态决定后续指令(例如指定终端异常,则断开所述与指定终端的连接,或者再次验证登陆帐号等)。并且本申请采用来自于消费终端的心跳检测时间间隔信息规定的时间间隔,首先使中间服务器不必设置时间间隔从而减少了步骤流程,提高了效率;并且由于消费终端自身设置的心跳检测时间间隔信息更适应于消费终端自身,因此不同的消费终端能够实现不同的并且最妥帖的时间时隔,从而使心跳检测的方式更加灵活。As described in the aforementioned unit 50, the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. Since the heartbeat subscription request sent by the consumer terminal to the specified terminal carries the heartbeat detection time interval information, that is, the consumer terminal requires the heartbeat detection time interval, so the heartbeat packet is sent according to the heartbeat detection time interval to complete the heartbeat packet send. The consumer terminal receiving the heartbeat packet can complete the heartbeat detection according to the heartbeat packet to determine the status of the designated terminal (abnormal or normal), and then determine the subsequent instructions according to the status of the designated terminal (for example, if the designated terminal is abnormal, disconnect The connection with the designated terminal, or re-verify the login account, etc.). In addition, this application adopts the time interval specified by the heartbeat detection time interval information from the consumer terminal. First, the intermediate server does not need to set the time interval, thereby reducing the procedure and improving the efficiency; and the heartbeat detection time interval information set by the consumer terminal itself is more It is adapted to the consumer terminal itself, so different consumer terminals can achieve different and most appropriate time intervals, thereby making the heartbeat detection method more flexible.
在一个实施方式中,所述装置,包括:In one embodiment, the device includes:
提供心跳服务列表判断单元,用于判断所述指定终端是否存在于预设的提供心跳服务列表中;Provide a heartbeat service list judging unit for judging whether the designated terminal exists in a preset heartbeat service list;
权限用户判断单元,用于若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;The authority user judging unit is configured to determine whether the login user of the consumer terminal is a authority user if the designated terminal exists in the preset heartbeat service list;
触发单元,用于若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。The triggering unit is configured to trigger the counting the number of consumer terminals that send the heartbeat subscription request if the login user of the consumer terminal is a privileged user, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than the preset number Set the threshold of the number of heartbeat subscriptions.
如上所述,实现了判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值。本实施方式通过判断所述指定终端是否存在于预设的提供心跳服务列表中,从而判断是否能够与所述指定终端实现心跳信息交互,再将消费终端分为有权限和没权限两类,只允许有权限的消费终端订阅心跳,从而实现分级化管理,也能降低中间服务器的压力。其中,提供心跳服务列表中预存了能够提供心跳包的终端。其中,判断所述消费终端的登陆用户是否为权限用户可以为任意方式,例如通过判断所述消费终端的登陆用户是否存在于预设的权限列表中。As described above, it is possible to determine whether the number of consumer terminals that send the heartbeat subscription request is greater than the preset threshold for the number of heartbeat subscriptions. In this embodiment, by judging whether the designated terminal exists in the preset list of providing heartbeat services, it is judged whether it can realize heartbeat information interaction with the designated terminal, and then the consumer terminals are divided into two types, authorized and non-authorized. Allow authorized consumer terminals to subscribe to the heartbeat, thereby achieving hierarchical management and reducing the pressure on the intermediate server. Among them, the terminal that can provide heartbeat packets is pre-stored in the list of providing heartbeat services. Wherein, judging whether the logged-in user of the consumer terminal is an authorized user may be in any manner, for example, by judging whether the logged-in user of the consumer terminal exists in a preset authorization list.
在一个实施方式中,所述权限用户判断单元,包括:In one embodiment, the authority user judgment unit includes:
登陆用户名获取模块,用于若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;The login user name obtaining module is configured to obtain the login user name of the consumer terminal if the designated terminal exists in the preset heartbeat service list;
权限级别获知模块,用于通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;The authority level learning module is used to query the login user name of the consumer terminal in the pre-stored authority user list to obtain the authority level of the consumer terminal. The authority user list includes the user name, authority level and authority level correspondence Terminal
权限级别对应的终端判断模块,用于判断所述消费终端的权限级别对应的终端是否包括所述指定终端;The terminal judgment module corresponding to the authority level is used to determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
权限用户判定模块,用于若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。The authority user determination module is configured to determine that the login user of the consumer terminal is the authority user if the terminal corresponding to the authority level of the consumer terminal includes the designated terminal.
如上所述,实现了判断所述消费终端的登陆用户是否为权限用户。本实施方式将权限用户的权限分为多个级别,进一步实现分级管理。例如对于预设的最高级权限用户,允许其对预设的提供心跳服务列表中的所有服务器订阅心跳信息;对于低级权限用户,只允许其对预设的提供心跳服务列表中的常用的部分服务器订阅心跳信息。其中确定所述权限用户的权限,通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端。若所述指定终端与所述消费终端的登陆用户的权限匹配(即权限足够),则判定所述消费终端的登陆用户为权限用户。As mentioned above, it is possible to determine whether the login user of the consumer terminal is a privileged user. In this embodiment, the authority of the authority user is divided into multiple levels to further realize hierarchical management. For example, for a preset user with the highest level of authority, it is allowed to subscribe heartbeat information to all servers in the preset list of providing heartbeat services; for a low-level user, it is only allowed to subscribe to some commonly used servers in the preset list of providing heartbeat services. Subscribe to heartbeat information. The authority of the authority user is determined, and the login user name of the consumer terminal is searched in a pre-stored authority user list to obtain the authority level of the consumer terminal. The authority user list includes the user name, authority level, and authority. The terminal corresponding to the level. If the authority of the login user of the designated terminal and the consumer terminal matches (that is, the authority is sufficient), it is determined that the login user of the consumer terminal is the authority user.
在一个实施方式中,所述装置,包括:In one embodiment, the device includes:
心跳订阅请求拒绝单元,用于若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;The heartbeat subscription request rejection unit is configured to reject the heartbeat subscription request sent by the consumer terminal if the number of consumer terminals sending the heartbeat subscription request is not greater than the preset heartbeat subscription number threshold;
发送建议信息单元,用于向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。The sending suggestion information unit is used to send to the consumer terminal information suggesting that the heartbeat packet be directly obtained from the designated terminal.
如上所述,实现了拒绝所述消费终端发送的心跳订阅请求。预设的心跳订阅数量阈值反应了指定终端对于心跳开销的忍受标准值。当发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值时,表明所述指定终端可以忍受采用现有技术的心跳检测的开销,因此消费终端直接向指定终端要求心跳包即可,无需通过中间服务器。因此拒绝所述消费终端发送的心跳订阅请求,然后向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。As described above, it is realized that the heartbeat subscription request sent by the consumer terminal is rejected. The preset threshold of the number of heartbeat subscriptions reflects the standard value of the endurance of the heartbeat overhead of the specified terminal. When the number of consumer terminals sending the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, it indicates that the designated terminal can tolerate the overhead of heartbeat detection using the prior art, so the consumer terminal directly requests the designated terminal for a heartbeat packet That's it, without going through an intermediate server. Therefore, it rejects the heartbeat subscription request sent by the consumer terminal, and then sends to the consumer terminal information suggesting that the heartbeat packet be directly obtained from the designated terminal.
在一个实施方式中,所述心跳包发送单元50,包括:In an embodiment, the heartbeat packet sending unit 50 includes:
消息中间件下发子单元,用于将所述心跳包下发至预设的消息中间件;The message middleware delivery subunit is used to deliver the heartbeat packet to a preset message middleware;
心跳包发送子单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。The heartbeat packet sending subunit is configured to send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
如上所述,实现了根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。本实施方式中利用预设的消息中间件发送心跳包。其中消息中间件(例如MQ消息队列服务(Message Queue,简称 MQ))是一种可部署于服务器的应用,用于保证异构应用之间的消息传递,通过MQ接口进行互连通信,可以不必关心网络上的通信细节。因此心跳包会在消息中间件中进行排队,等待被发送给消费终端。由于消费终端一般需要的是最新的心跳包,因此只需从所述消息中间件中最近一次接收到的心跳包(若指定终端发送心跳包的频率较高,则会出现在一个所述心跳检测时间间隔信息规定的时间间隔内,接收到多个心跳包的情况)发送给所述消费终端,即可完成心跳包发送过程。进一步地,还可以将所述消息中间件中的所有心跳包均发送给消费终端。As described above, the heartbeat packet is sent to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. In this embodiment, a preset message middleware is used to send the heartbeat packet. Among them, message middleware (such as MQ message queue service (Message Queue, MQ)) is an application that can be deployed on the server to ensure message transfer between heterogeneous applications. The MQ interface is used for interconnection and communication. Care about the details of communication on the network. Therefore, the heartbeat packet will be queued in the message middleware, waiting to be sent to the consumer terminal. Since consumer terminals generally need the latest heartbeat packet, they only need the latest heartbeat packet received from the message middleware (if the designated terminal sends heartbeat packets more frequently, it will appear in one of the heartbeat detection Within the time interval specified by the time interval information, multiple heartbeat packets are received) and sent to the consumer terminal to complete the heartbeat packet sending process. Further, all heartbeat packets in the message middleware can also be sent to the consumer terminal.
在一个实施方式中,所述心跳包发送单元50,包括:In an embodiment, the heartbeat packet sending unit 50 includes:
心跳异常判断子单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;The heartbeat abnormality judgment subunit is used to judge the designated terminal according to the time interval specified by the heartbeat detection time interval information, at the first time point after the current time when the heartbeat packet is sent, and according to the preset heartbeat abnormal judgment rule Is it abnormal;
异常的信息发送子单元,用于若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The abnormal information sending subunit is configured to, if the designated terminal is abnormal, send the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sent the heartbeat subscription request.
如上所述,实现了发送心跳包。现有技术一般只由终端本身进行判断心跳是否异常,即需要终端先接收心跳包,再借由心跳包判断指定终端是否异常。本实施方式却是先由中间服务器执行判断所述指定终端是否异常的流程,从而在发送心跳包给消费终端前即可得到指定终端是否异常,相较于现有技术,更加快捷,节省时间,尤其适宜时效性要求高的情境。因此,若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。进一步地,所述消费终端还能利用心跳包进一步核实中间服务器的判断结论是否准确。As mentioned above, the heartbeat packet is sent. The prior art generally only determines whether the heartbeat is abnormal by the terminal itself, that is, the terminal needs to receive the heartbeat packet first, and then judge whether the designated terminal is abnormal by the heartbeat packet. In this embodiment, the intermediate server first executes the process of judging whether the designated terminal is abnormal, so that whether the designated terminal is abnormal can be obtained before sending the heartbeat packet to the consumer terminal. Compared with the prior art, it is faster and saves time. Especially suitable for situations requiring high timeliness. Therefore, if the designated terminal is abnormal, the abnormal information of the designated terminal and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request. Further, the consumer terminal can use the heartbeat packet to further verify whether the judgment conclusion of the intermediate server is accurate.
在一个实施方式中,所述心跳异常判断子单元,包括:In one embodiment, the abnormal heartbeat judgment subunit includes:
时间间隔判断模块,用于根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,判断当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔;The time interval judgment module is used to judge whether the difference between the current time and the time of the last heartbeat packet reception at the first time point after the current time when the heartbeat packet is sent according to the time interval specified by the heartbeat detection time interval information Greater than 2 × the time interval specified by the heartbeat detection time interval information;
异常判定模块,用于若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,则判定所述指定终端异常。The abnormality determination module is configured to determine that the designated terminal is abnormal if the difference between the current time and the time of the last heartbeat packet reception is greater than 2× the time interval specified by the heartbeat detection time interval information.
如上所述,实现了根据预设的心跳异常判断规则,判断所述指定终端是否异常。本实施方式采用的预设的心跳异常判断规则为:当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔。若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,判定指定终端异常;若当前时间-最后一次接收心跳包的时间的差值不大于2×所述心跳检测时间间隔信息规定的时间间隔,判定指定终端正常。As described above, it is realized whether the designated terminal is abnormal according to the preset heartbeat abnormality judgment rule. The preset heartbeat abnormality judgment rule adopted in this embodiment is: whether the difference between the current time and the time of the last heartbeat packet reception is greater than 2×the time interval specified by the heartbeat detection time interval information. If the difference between the current time-the time of the last heartbeat packet reception is greater than 2 × the time interval specified by the heartbeat detection time interval information, the designated terminal is determined to be abnormal; if the difference between the current time-the time of the last heartbeat packet reception is not greater than 2×The time interval specified by the heartbeat detection time interval information, and it is determined that the designated terminal is normal.
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储基于中间服务器的心跳包发送方法所用数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种基于中间服务器的心跳包发送方法。3, an embodiment of the present application also provides a computer device. The computer device may be a server, and its internal structure may be as shown in the figure. The computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer readable instructions, and a database. The memory provides an environment for the operation of the operating system and computer readable instructions in the non-volatile storage medium. The database of the computer equipment is used to store the data used in the heartbeat packet sending method based on the intermediate server. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer readable instruction is executed by the processor to realize a heartbeat packet sending method based on the intermediate server.
上述处理器执行上述基于中间服务器的心跳包发送方法,包括以下步骤:接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;接收所述指定终端根据所述心跳包获取要求发送的心跳包;根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The foregoing processor executes the foregoing method for sending a heartbeat packet based on an intermediate server, including the following steps: receiving a heartbeat subscription request for a specified terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information; and sending the heartbeat subscription statistics The number of consumer terminals requested, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold; if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold , Send the heartbeat packet acquisition request to the designated terminal; receive the heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request; send the heartbeat packet to the time interval specified by the heartbeat detection time interval information The consumer terminal that sends the heartbeat subscription request.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之前,包括:判断所述指定终端是否存在于预设的提供心跳服务列表中;若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。In one embodiment, before the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the step includes: determining Whether the designated terminal exists in the preset list of providing heartbeat services; if the designated terminal exists in the preset list of providing heartbeat services, determine whether the login user of the consumer terminal is a authorized user; if the consumer terminal If the login user is a privileged user, the step of counting the number of consumer terminals sending the heartbeat subscription request is triggered, and judging whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
在一个实施方式中,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤,包括:若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;判断所述消费终端的权限级别对应的终端是否包括所述指定终端;若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。In one embodiment, the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services , Including: if the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal; and obtaining the login user name of the consumer terminal in the pre-stored list of authorized users The authority level of the consumer terminal, the authority user list includes the user name, authority level, and the terminal corresponding to the authority level; determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal; If the terminal corresponding to the authority level includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之后,包括:若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。In one embodiment, after the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the method includes: If the number of consumer terminals that send the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, the heartbeat subscription request sent by the consumer terminal is rejected; the consumer terminal is advised to obtain the heartbeat packet directly from the designated terminal information.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:将所述心跳包下发至预设的消息中间件;根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。In one embodiment, the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: downloading the heartbeat packet Send to a preset message middleware; according to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。In one embodiment, the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: according to the heartbeat detection time The time interval specified by the interval information, at the first time point after the current time when the heartbeat packet is sent, according to the preset heartbeat abnormality judgment rules, determine whether the designated terminal is abnormal; if the designated terminal is abnormal, the designated terminal The abnormal information and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常的步骤,包括:根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,判断当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔;若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,则判定所述指定终端异常。In one embodiment, according to the time interval specified by the heartbeat detection time interval information, the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time The step of abnormality includes: judging whether the difference between the current time and the time of the last heartbeat packet reception at the first time point of sending a heartbeat packet after the current time according to the time interval specified by the heartbeat detection time interval information Greater than 2 × the time interval specified by the heartbeat detection time interval information; if the difference between the current time and the time of the last heartbeat packet reception is greater than 2 × the time interval specified by the heartbeat detection time interval information, determine the designated terminal abnormal.
本领域技术人员可以理解,图中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。Those skilled in the art can understand that the structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
本申请一实施例还提供一种计算机可读存储介质,其上存储有计算机可读指令,计算机可读指令被处理器执行时实现基于中间服务器的心跳包发送方法,包括以下步骤:接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;接收所述指定终端根据所述心跳包获取要求发送的心跳包;根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。所述计算机可读存储介质,例如为非易失性的计算机可读存储介质,或者为易失性的计算机可读存储介质。An embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor, a method for sending a heartbeat packet based on an intermediate server is implemented, including the following steps: receiving a consumer terminal A sent heartbeat subscription request to a specified terminal, the heartbeat subscription request carries heartbeat detection time interval information; the number of consumer terminals that sent the heartbeat subscription request is counted, and the number of consumer terminals that sent the heartbeat subscription request is determined whether Is greater than the preset heartbeat subscription number threshold; if the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, send a heartbeat packet acquisition request to the designated terminal; receive the designated terminal according to the The heartbeat packet obtains the heartbeat packet required to be sent; and sends the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information. The computer-readable storage medium is, for example, a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之前,包括:判断所述指定终端是否存在于预设的提供心跳服务列表中;若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。In one embodiment, before the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the step includes: determining Whether the designated terminal exists in the preset list of providing heartbeat services; if the designated terminal exists in the preset list of providing heartbeat services, determine whether the login user of the consumer terminal is a authorized user; if the consumer terminal If the login user is a privileged user, the step of counting the number of consumer terminals sending the heartbeat subscription request is triggered, and judging whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold.
在一个实施方式中,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤,包括:若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;判断所述消费终端的权限级别对应的终端是否包括所述指定终端;若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。In one embodiment, the authority of the authorized user is divided into multiple levels, and the step of judging whether the login user of the consumer terminal is a authorized user if the designated terminal exists in a preset list of providing heartbeat services , Including: if the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal; and obtaining the login user name of the consumer terminal in the pre-stored list of authorized users The authority level of the consumer terminal, the authority user list includes the user name, authority level, and the terminal corresponding to the authority level; determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal; If the terminal corresponding to the authority level includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
在一个实施方式中,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之后,包括:若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。In one embodiment, after the step of counting the number of consumer terminals sending the heartbeat subscription request, and determining whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold, the method includes: If the number of consumer terminals that send the heartbeat subscription request is not greater than the preset threshold of the number of heartbeat subscriptions, the heartbeat subscription request sent by the consumer terminal is rejected; the consumer terminal is advised to obtain the heartbeat packet directly from the designated terminal information.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:将所述心跳包下发至预设的消息中间件;根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。In one embodiment, the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: downloading the heartbeat packet Send to a preset message middleware; according to the time interval specified by the heartbeat detection time interval information, send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。In one embodiment, the step of sending the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information includes: according to the heartbeat detection time The time interval specified by the interval information, at the first time point after the current time when the heartbeat packet is sent, according to the preset heartbeat abnormality judgment rules, determine whether the designated terminal is abnormal; if the designated terminal is abnormal, the designated terminal The abnormal information and the heartbeat packet are sent to the consumer terminal that sends the heartbeat subscription request.
在一个实施方式中,所述根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常的步骤,包括:根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,判断当前时间-最后一次接收心跳包的时间的差值是否大于2×所述心跳检测时间间隔信息规定的时间间隔;若当前时间-最后一次接收心跳包的时间的差值大于2×所述心跳检测时间间隔信息规定的时间间隔,则判定所述指定终端异常。In one embodiment, according to the time interval specified by the heartbeat detection time interval information, the designated terminal is determined according to a preset heartbeat abnormality judgment rule at the first time point of sending a heartbeat packet after the current time The step of abnormality includes: judging whether the difference between the current time and the time of the last heartbeat packet reception at the first time point of sending a heartbeat packet after the current time according to the time interval specified by the heartbeat detection time interval information Greater than 2 × the time interval specified by the heartbeat detection time interval information; if the difference between the current time and the time of the last heartbeat packet reception is greater than 2 × the time interval specified by the heartbeat detection time interval information, determine the designated terminal abnormal.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through computer-readable instructions, which can be stored in a non-volatile computer. In a readable storage medium, when the computer-readable instructions are executed, they may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of this application description and drawings, or directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of this application.

Claims (20)

  1. 一种基于中间服务器的心跳包发送方法,其特征在于,包括:A heartbeat packet sending method based on an intermediate server, which is characterized in that it includes:
    接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;Receiving a heartbeat subscription request for a designated terminal sent by a consumer terminal, where the heartbeat subscription request carries heartbeat detection time interval information;
    统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;Count the number of consumer terminals that send the heartbeat subscription request, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
    若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;If the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, sending a heartbeat packet acquisition request to the designated terminal;
    接收所述指定终端根据所述心跳包获取要求发送的心跳包;Receiving a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
    根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。Send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  2. 根据权利要求1所述的基于中间服务器的心跳包发送方法,其特征在于,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之前,包括:The method for sending heartbeat packets based on an intermediate server according to claim 1, wherein the counting the number of consumer terminals that send the heartbeat subscription request, and determining whether the number of consumer terminals that send the heartbeat subscription request is greater than Before the steps to set the threshold of the number of heartbeat subscriptions, include:
    判断所述指定终端是否存在于预设的提供心跳服务列表中;Judging whether the designated terminal exists in a preset list of providing heartbeat services;
    若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;If the designated terminal exists in the preset list of providing heartbeat services, determining whether the login user of the consumer terminal is a authorized user;
    若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。If the logged-in user of the consumer terminal is a privileged user, trigger the counting of the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than the preset number of heartbeat subscriptions Threshold steps.
  3. 根据权利要求2所述的基于中间服务器的心跳包发送方法,其特征在于,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤,包括:The method for sending heartbeat packets based on an intermediate server according to claim 2, wherein the authority of the authorized user is divided into multiple levels, and if the designated terminal exists in a preset list of providing heartbeat services, The step of judging whether the login user of the consumer terminal is a privileged user includes:
    若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;If the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal;
    通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;Obtain the authority level of the consumer terminal by querying the login user name of the consumer terminal in the pre-stored authority user list, the authority user list including the user name, authority level, and terminal corresponding to the authority level;
    判断所述消费终端的权限级别对应的终端是否包括所述指定终端;Determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
    若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。If the terminal corresponding to the authority level of the consumer terminal includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
  4. 根据权利要求1所述的基于中间服务器的心跳包发送方法,其特征在于,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之后,包括:The method for sending heartbeat packets based on an intermediate server according to claim 1, wherein the counting the number of consumer terminals that send the heartbeat subscription request, and determining whether the number of consumer terminals that send the heartbeat subscription request is greater than After the preset threshold of the number of heartbeat subscriptions, the steps include:
    若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;If the number of consumer terminals sending the heartbeat subscription request is not greater than the preset heartbeat subscription number threshold, reject the heartbeat subscription request sent by the consumer terminal;
    向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。Sending to the consumer terminal information suggesting to obtain the heartbeat packet directly from the designated terminal.
  5. 根据权利要求1所述的基于中间服务器的心跳包发送方法,其特征在于,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:The method for sending a heartbeat packet based on an intermediate server according to claim 1, wherein the heartbeat packet is sent to the sending the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information The steps of the consumer terminal include:
    将所述心跳包下发至预设的消息中间件;Sending the heartbeat packet to a preset message middleware;
    根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。According to the time interval specified by the heartbeat detection time interval information, the most recently received heartbeat packet in the message middleware is sent to the consumer terminal that sent the heartbeat subscription request.
  6. 根据权利要求1所述的基于中间服务器的心跳包发送方法,其特征在于,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:The method for sending a heartbeat packet based on an intermediate server according to claim 1, wherein the heartbeat packet is sent to the sending the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information The steps of the consumer terminal include:
    根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;According to the time interval specified by the heartbeat detection time interval information, at the first time point of sending a heartbeat packet after the current time, according to a preset heartbeat abnormality judgment rule, determine whether the designated terminal is abnormal;
    若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。If the designated terminal is abnormal, sending the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sent the heartbeat subscription request.
  7. 根据权利要求1所述的基于中间服务器的心跳包发送方法,其特征在于,所述根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端的步骤,包括:The method for sending a heartbeat packet based on an intermediate server according to claim 1, wherein the heartbeat packet is sent to the sending the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information The steps of the consumer terminal include:
    将所述心跳包下发至预设的消息中间件;Sending the heartbeat packet to a preset message middleware;
    将所述消息中间件中的所有心跳包均发送给所述发送所述心跳订阅请求的消费终端。All the heartbeat packets in the message middleware are sent to the consumer terminal that sends the heartbeat subscription request.
  8. 一种基于中间服务器的心跳包发送装置,其特征在于,包括:A heartbeat packet sending device based on an intermediate server is characterized in that it comprises:
    心跳订阅请求接收单元,用于接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;A heartbeat subscription request receiving unit, configured to receive a heartbeat subscription request for a designated terminal sent by a consumer terminal, the heartbeat subscription request carrying heartbeat detection time interval information;
    心跳订阅数量阈值判断单元,用于统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;The heartbeat subscription quantity threshold judging unit is configured to count the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription quantity threshold;
    心跳包获取要求发送单元,用于若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;A heartbeat packet acquisition request sending unit, configured to send a heartbeat packet acquisition request to the designated terminal if the number of consumer terminals sending the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
    心跳包接收单元,用于接收所述指定终端根据所述心跳包获取要求发送的心跳包;A heartbeat packet receiving unit, configured to receive a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
    心跳包发送单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The heartbeat packet sending unit is configured to send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  9. 根据权利要求8所述的基于中间服务器的心跳包发送装置,其特征在于,所述装置,包括:The device for sending heartbeat packets based on an intermediate server according to claim 8, wherein the device comprises:
    提供心跳服务列表判断单元,用于判断所述指定终端是否存在于预设的提供心跳服务列表中;Provide a heartbeat service list judging unit for judging whether the designated terminal exists in a preset heartbeat service list;
    权限用户判断单元,用于若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;The authority user judging unit is configured to determine whether the login user of the consumer terminal is a authority user if the designated terminal exists in the preset heartbeat service list;
    触发单元,用于若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。The triggering unit is configured to trigger the counting the number of consumer terminals that send the heartbeat subscription request if the login user of the consumer terminal is a privileged user, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than the preset number Set the threshold of the number of heartbeat subscriptions.
  10. 根据权利要求9所述的基于中间服务器的心跳包发送装置,其特征在于,所述权限用户判断单元,包括:The device for sending a heartbeat packet based on an intermediate server according to claim 9, wherein the authority user judgment unit comprises:
    登陆用户名获取模块,用于若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;The login user name obtaining module is configured to obtain the login user name of the consumer terminal if the designated terminal exists in the preset heartbeat service list;
    权限级别获知模块,用于通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;The authority level learning module is used to query the login user name of the consumer terminal in the pre-stored authority user list to obtain the authority level of the consumer terminal. The authority user list includes the user name, authority level and authority level correspondence Terminal
    权限级别对应的终端判断模块,用于判断所述消费终端的权限级别对应的终端是否包括所述指定终端;The terminal judgment module corresponding to the authority level is used to determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
    权限用户判定模块,用于若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。The authority user determination module is configured to determine that the login user of the consumer terminal is the authority user if the terminal corresponding to the authority level of the consumer terminal includes the designated terminal.
  11. 根据权利要求8所述的基于中间服务器的心跳包发送装置,其特征在于,所述装置,包括:The device for sending heartbeat packets based on an intermediate server according to claim 8, wherein the device comprises:
    心跳订阅请求拒绝单元,用于若发送所述心跳订阅请求的消费终端的数量不大于预设的心跳订阅数量阈值,则拒绝所述消费终端发送的心跳订阅请求;The heartbeat subscription request rejection unit is configured to reject the heartbeat subscription request sent by the consumer terminal if the number of consumer terminals sending the heartbeat subscription request is not greater than the preset heartbeat subscription number threshold;
    发送建议信息单元,用于向所述消费终端发送建议直接从所述指定终端获取心跳包的信息。The sending suggestion information unit is used to send to the consumer terminal information suggesting that the heartbeat packet be directly obtained from the designated terminal.
  12. 根据权利要求8所述的基于中间服务器的心跳包发送装置,其特征在于,所述心跳包发送单元,包括:The heartbeat packet sending device based on the intermediate server according to claim 8, wherein the heartbeat packet sending unit comprises:
    消息中间件下发子单元,用于将所述心跳包下发至预设的消息中间件;The message middleware delivery subunit is used to deliver the heartbeat packet to a preset message middleware;
    心跳包发送子单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,将所述消息中间件中最近一次接收到的心跳包发送给所述发送所述心跳订阅请求的消费终端。The heartbeat packet sending subunit is configured to send the most recently received heartbeat packet in the message middleware to the consumer terminal that sent the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  13. 根据权利要求8所述的基于中间服务器的心跳包发送装置,其特征在于,所述心跳包发送单元,包括:The heartbeat packet sending device based on the intermediate server according to claim 8, wherein the heartbeat packet sending unit comprises:
    心跳异常判断子单元,用于根据所述心跳检测时间间隔信息规定的时间间隔,在当前时间之后的第一个发送心跳包的时间点,根据预设的心跳异常判断规则,判断所述指定终端是否异常;The heartbeat abnormality judgment subunit is used to judge the designated terminal according to the time interval specified by the heartbeat detection time interval information, at the first time point after the current time when the heartbeat packet is sent, and according to the preset heartbeat abnormal judgment rule Is it abnormal;
    异常的信息发送子单元,用于若所述指定终端异常,则将指定终端异常的信息与所述心跳包发送给所述发送所述心跳订阅请求的消费终端。The abnormal information sending subunit is configured to, if the designated terminal is abnormal, send the abnormal information of the designated terminal and the heartbeat packet to the consumer terminal that sent the heartbeat subscription request.
  14. 根据权利要求8所述的基于中间服务器的心跳包发送装置,其特征在于,所述心跳包发送单元,包括:The heartbeat packet sending device based on the intermediate server according to claim 8, wherein the heartbeat packet sending unit comprises:
    心跳包下发单元,用于将所述心跳包下发至预设的消息中间件;A heartbeat packet delivery unit, configured to deliver the heartbeat packet to a preset message middleware;
    全部发送单元,用于将所述消息中间件中的所有心跳包均发送给所述发送所述心跳订阅请求的消费终端。The all sending unit is configured to send all heartbeat packets in the message middleware to the consumer terminal that sends the heartbeat subscription request.
  15. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现基于中间服务器的心跳包发送方法,所述基于中间服务器的心跳包发送方法,包括:A computer device includes a memory and a processor, the memory stores computer-readable instructions, and is characterized in that, when the processor executes the computer-readable instructions, a heartbeat packet sending method based on an intermediate server is implemented, and the method is based on The heartbeat packet sending method of the intermediate server includes:
    接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;Receiving a heartbeat subscription request for a designated terminal sent by a consumer terminal, where the heartbeat subscription request carries heartbeat detection time interval information;
    统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;Count the number of consumer terminals that send the heartbeat subscription request, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
    若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;If the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, sending a heartbeat packet acquisition request to the designated terminal;
    接收所述指定终端根据所述心跳包获取要求发送的心跳包;Receiving a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
    根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。Send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  16. 根据权利要求15所述的计算机设备,其特征在于,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之前,包括:The computer device according to claim 15, wherein the number of consumer terminals sending the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals sending the heartbeat subscription request is greater than a preset number of heartbeat subscriptions Before the threshold step, include:
    判断所述指定终端是否存在于预设的提供心跳服务列表中;Judging whether the designated terminal exists in a preset list of providing heartbeat services;
    若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;If the designated terminal exists in the preset list of providing heartbeat services, determining whether the login user of the consumer terminal is a authorized user;
    若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。If the logged-in user of the consumer terminal is a privileged user, trigger the counting of the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than the preset number of heartbeat subscriptions Threshold steps.
  17. 根据权利要求16所述的计算机设备,其特征在于,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤,包括:The computer device according to claim 16, wherein the authority of the authorized user is divided into multiple levels, and if the designated terminal exists in a preset list of providing heartbeat services, it is determined whether the consumer terminal has The steps for whether the login user is a privileged user include:
    若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;If the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal;
    通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;Obtain the authority level of the consumer terminal by querying the login user name of the consumer terminal in the pre-stored authority user list, the authority user list including the user name, authority level, and terminal corresponding to the authority level;
    判断所述消费终端的权限级别对应的终端是否包括所述指定终端;Determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
    若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。If the terminal corresponding to the authority level of the consumer terminal includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
  18. 一种计算机可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现基于中间服务器的心跳包发送方法,所述基于中间服务器的心跳包发送方法,包括:A computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions implement a heartbeat packet sending method based on an intermediate server when executed by a processor, and the heartbeat packet based on the intermediate server Sending methods, including:
    接收消费终端发送的对指定终端的心跳订阅请求,所述心跳订阅请求携带有心跳检测时间间隔信息;Receiving a heartbeat subscription request for a designated terminal sent by a consumer terminal, where the heartbeat subscription request carries heartbeat detection time interval information;
    统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值;Count the number of consumer terminals that send the heartbeat subscription request, and determine whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset heartbeat subscription number threshold;
    若发送所述心跳订阅请求的消费终端的数量大于预设的心跳订阅数量阈值,则向所述指定终端发送心跳包获取要求;If the number of consumer terminals sending the heartbeat subscription request is greater than the preset heartbeat subscription number threshold, sending a heartbeat packet acquisition request to the designated terminal;
    接收所述指定终端根据所述心跳包获取要求发送的心跳包;Receiving a heartbeat packet sent by the designated terminal according to the heartbeat packet acquisition request;
    根据所述心跳检测时间间隔信息规定的时间间隔,将所述心跳包发送给所述发送所述心跳订阅请求的消费终端。Send the heartbeat packet to the consumer terminal that sends the heartbeat subscription request according to the time interval specified by the heartbeat detection time interval information.
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤之前,包括:The computer-readable storage medium according to claim 18, wherein the number of consumer terminals that send the heartbeat subscription request is counted, and it is determined whether the number of consumer terminals that send the heartbeat subscription request is greater than a preset Before the heartbeat subscription number threshold, the steps include:
    判断所述指定终端是否存在于预设的提供心跳服务列表中;Judging whether the designated terminal exists in a preset list of providing heartbeat services;
    若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户;If the designated terminal exists in the preset list of providing heartbeat services, determining whether the login user of the consumer terminal is a authorized user;
    若所述消费终端的登陆用户为权限用户,则触发所述统计发送所述心跳订阅请求的消费终端的数量,并判断发送所述心跳订阅请求的消费终端的数量是否大于预设的心跳订阅数量阈值的步骤。If the logged-in user of the consumer terminal is a privileged user, trigger the counting of the number of consumer terminals sending the heartbeat subscription request, and determine whether the number of consumer terminals sending the heartbeat subscription request is greater than the preset number of heartbeat subscriptions Threshold steps.
  20. 根据权利要求19所述的计算机可读存储介质,其特征在于,所述权限用户的权限分为多个级别,所述若所述指定终端存在于预设的提供心跳服务列表中,判断所述消费终端的登陆用户是否为权限用户的步骤,包括:The computer-readable storage medium according to claim 19, wherein the authority of the authorized user is divided into multiple levels, and if the designated terminal exists in a preset list of providing heartbeat services, it is determined that the The steps for whether the login user of the consumer terminal is a privileged user includes:
    若所述指定终端存在于预设的提供心跳服务列表中,则获取所述消费终端的登陆用户名;If the designated terminal exists in the preset list of providing heartbeat services, acquiring the login user name of the consumer terminal;
    通过在预存的权限用户列表中查询所述消费终端的登陆用户名,以获知所述消费终端的权限级别,所述权限用户列表包括用户名、权限级别和权限级别对应的终端;Obtain the authority level of the consumer terminal by querying the login user name of the consumer terminal in the pre-stored authority user list, the authority user list including the user name, authority level, and terminal corresponding to the authority level;
    判断所述消费终端的权限级别对应的终端是否包括所述指定终端;Determine whether the terminal corresponding to the authority level of the consumer terminal includes the designated terminal;
    若所述消费终端的权限级别对应的终端包括所述指定终端,则判定所述消费终端的登陆用户为权限用户。If the terminal corresponding to the authority level of the consumer terminal includes the designated terminal, it is determined that the login user of the consumer terminal is the authority user.
PCT/CN2019/119220 2019-04-19 2019-11-18 Heartbeat packet sending method and apparatus based on intermediate server, and computer device WO2020211373A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910319043.9 2019-04-19
CN201910319043.9A CN110149368A (en) 2019-04-19 2019-04-19 Heartbeat packet transmission method, device and computer equipment based on intermediate server

Publications (1)

Publication Number Publication Date
WO2020211373A1 true WO2020211373A1 (en) 2020-10-22

Family

ID=67589662

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/119220 WO2020211373A1 (en) 2019-04-19 2019-11-18 Heartbeat packet sending method and apparatus based on intermediate server, and computer device

Country Status (2)

Country Link
CN (1) CN110149368A (en)
WO (1) WO2020211373A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506702A (en) * 2020-12-03 2021-03-16 平安科技(深圳)有限公司 Data center disaster tolerance method, device, equipment and storage medium
CN112714026A (en) * 2021-01-21 2021-04-27 广州朗国电子科技有限公司 MQTT protocol consumer clustering method, device and storage medium
CN113612624A (en) * 2021-06-29 2021-11-05 济南浪潮数据技术有限公司 Method and device for processing heartbeat between nodes
CN114221884A (en) * 2021-11-18 2022-03-22 新华三技术有限公司合肥分公司 Heartbeat message subscription method and device
CN114785846A (en) * 2022-03-23 2022-07-22 南京邮电大学 Heartbeat monitoring method and system based on ProtoBuf protocol
US11418942B2 (en) * 2020-12-22 2022-08-16 T-Mobile Usa, Inc. Protecting a user data repository (UDR) from over-accumulation of subscription requests in a standalone 5G network
CN115087087A (en) * 2021-03-15 2022-09-20 中国电信股份有限公司 Service synchronization method, dual-card terminal and non-transitory computer readable storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110149368A (en) * 2019-04-19 2019-08-20 平安科技(深圳)有限公司 Heartbeat packet transmission method, device and computer equipment based on intermediate server
CN110602188A (en) * 2019-08-30 2019-12-20 延锋伟世通电子科技(上海)有限公司 Data distribution method based on DDS middleware
CN114342447B (en) * 2019-09-06 2023-08-29 上海诺基亚贝尔股份有限公司 Managing notifications for communication supervision
CN110768873B (en) * 2019-10-31 2021-08-10 广州酷旅旅行社有限公司 Distributed heartbeat detection method, system and device and computer equipment
CN114205270B (en) * 2020-09-17 2023-09-22 北京三快在线科技有限公司 Device state determining method and device, storage medium and electronic device
CN113114538A (en) * 2021-04-19 2021-07-13 中国工商银行股份有限公司 Heartbeat detection method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050108390A1 (en) * 2003-11-17 2005-05-19 Oracle International Corporation System and method for managing browser sessions in single and multi-server workflow environments
CN107222371A (en) * 2017-08-04 2017-09-29 北京奇艺世纪科技有限公司 A kind of client heartbeat inspecting method and system
CN108509280A (en) * 2018-04-23 2018-09-07 南京大学 A kind of Distributed Calculation cluster locality dispatching method based on push model
CN110149368A (en) * 2019-04-19 2019-08-20 平安科技(深圳)有限公司 Heartbeat packet transmission method, device and computer equipment based on intermediate server

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8261290B2 (en) * 2005-12-30 2012-09-04 Microsoft Corporation Heartbeat subscriptions
WO2012167464A1 (en) * 2011-07-01 2012-12-13 华为技术有限公司 Heartbeat message transmission method and heartbeat proxy server
CN105933199B (en) * 2016-04-08 2019-07-09 武汉斗鱼网络科技有限公司 A kind of method and gateway and chat server keeping heartbeat connection
US10084678B2 (en) * 2016-04-19 2018-09-25 International Business Machines Corporation Managing connections for data communications using heartbeat messaging
CN108055651A (en) * 2017-11-14 2018-05-18 华中科技大学 A kind of mobile terminal device heartbeat package transmitting method based on D2D technologies

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050108390A1 (en) * 2003-11-17 2005-05-19 Oracle International Corporation System and method for managing browser sessions in single and multi-server workflow environments
CN107222371A (en) * 2017-08-04 2017-09-29 北京奇艺世纪科技有限公司 A kind of client heartbeat inspecting method and system
CN108509280A (en) * 2018-04-23 2018-09-07 南京大学 A kind of Distributed Calculation cluster locality dispatching method based on push model
CN110149368A (en) * 2019-04-19 2019-08-20 平安科技(深圳)有限公司 Heartbeat packet transmission method, device and computer equipment based on intermediate server

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506702A (en) * 2020-12-03 2021-03-16 平安科技(深圳)有限公司 Data center disaster tolerance method, device, equipment and storage medium
CN112506702B (en) * 2020-12-03 2024-02-23 平安科技(深圳)有限公司 Disaster recovery method, device, equipment and storage medium for data center
US11418942B2 (en) * 2020-12-22 2022-08-16 T-Mobile Usa, Inc. Protecting a user data repository (UDR) from over-accumulation of subscription requests in a standalone 5G network
US11805402B2 (en) 2020-12-22 2023-10-31 T-Mobile Usa, Inc. Protecting a user data repository (UDR) from over-accumulation of subscription requests in a standalone 5G network
CN112714026A (en) * 2021-01-21 2021-04-27 广州朗国电子科技有限公司 MQTT protocol consumer clustering method, device and storage medium
CN115087087A (en) * 2021-03-15 2022-09-20 中国电信股份有限公司 Service synchronization method, dual-card terminal and non-transitory computer readable storage medium
CN113612624A (en) * 2021-06-29 2021-11-05 济南浪潮数据技术有限公司 Method and device for processing heartbeat between nodes
CN113612624B (en) * 2021-06-29 2023-01-06 济南浪潮数据技术有限公司 Method and device for processing heartbeat between nodes
CN114221884A (en) * 2021-11-18 2022-03-22 新华三技术有限公司合肥分公司 Heartbeat message subscription method and device
CN114221884B (en) * 2021-11-18 2023-12-26 新华三技术有限公司合肥分公司 Method and device for subscribing heartbeat messages
CN114785846A (en) * 2022-03-23 2022-07-22 南京邮电大学 Heartbeat monitoring method and system based on ProtoBuf protocol
CN114785846B (en) * 2022-03-23 2024-05-24 南京邮电大学 Method and system for heartbeat monitoring based on ProtoBuf protocol

Also Published As

Publication number Publication date
CN110149368A (en) 2019-08-20

Similar Documents

Publication Publication Date Title
WO2020211373A1 (en) Heartbeat packet sending method and apparatus based on intermediate server, and computer device
US8599695B2 (en) Selective internet priority service
US9166965B2 (en) Method and system for automated user authentication for a priority communication session
EP2561665B1 (en) Pre-scheduling of quality of service reservation
JP5478777B2 (en) Optimize presence information refresh for wireless devices
US20110173681A1 (en) flexible authentication and authorization mechanism
US20160044168A1 (en) Facilitating Arrangement in a Communication System
US20100009704A1 (en) Method, System, and Apparatus for Processing a Service Message with a Plurality of Terminals
US9391846B2 (en) Policy formulating method, policy server, and gateway
RU2012104527A (en) METHODS AND DEVICES FOR INITIATING SUBSCRIBER DATA SUPPLY IN HSS NETWORK OF MULTIMEDIA IP PROTOCOL SUBSYSTEM
US9882852B2 (en) Techniques for escalating temporary messaging bans
EP2797285B1 (en) Method and apparatus for network communication
US20150149629A1 (en) User online state querying method and apparatus
US11070426B2 (en) Mechanisms for the adaptive control of service layer operations
US11419167B2 (en) Session initiated protocol (SIP) session establishment with a home subscriber server (HSS) outage
KR20100060130A (en) System for protecting private information and method thereof
US11659607B2 (en) Session initiated protocol (SIP) session establishment with a home subscriber server (HSS) outage
US11856138B2 (en) Parallel path caller verification controller
KR101308628B1 (en) Server and method for transferring mms contents during call from soip device
CN111224886A (en) Network traffic control method and system
WO2019067817A1 (en) Enhanced resource sharing using reservation
CN114760362B (en) Method, system, electronic device and storage medium for scheduling network access request
US10348653B2 (en) Scheduling of presence information transfer
US20140129724A1 (en) End network decider
WO2021109786A1 (en) Terminal desktop content monitoring method, platform, terminal, system and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19925033

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19925033

Country of ref document: EP

Kind code of ref document: A1