WO2017080328A1 - 终端用户状态获取方法、装置和系统 - Google Patents

终端用户状态获取方法、装置和系统 Download PDF

Info

Publication number
WO2017080328A1
WO2017080328A1 PCT/CN2016/100403 CN2016100403W WO2017080328A1 WO 2017080328 A1 WO2017080328 A1 WO 2017080328A1 CN 2016100403 W CN2016100403 W CN 2016100403W WO 2017080328 A1 WO2017080328 A1 WO 2017080328A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
heartbeat
heartbeat message
state
access
Prior art date
Application number
PCT/CN2016/100403
Other languages
English (en)
French (fr)
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 WO2017080328A1 publication Critical patent/WO2017080328A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/22Processing or transfer of terminal data, e.g. status or physical capabilities
    • H04W8/24Transfer of terminal data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/16Discovering, processing access restriction or access information

Definitions

  • the present invention relates to the field of information interaction technologies, and in particular, to a terminal user state acquisition method, apparatus, and system.
  • IPTV IP broadband network
  • IPTV IP broadband network
  • IPTV IPTV
  • STB Set-Top-Box
  • PC personal computer
  • Pad Pad
  • mobile phones etc.
  • value-added services such as advertisements, message notifications, and voting
  • the heartbeat mechanism is used to maintain the online state of the user mainly through the terminal system and the IPTV portal system EPG (Electronic Program Guide).
  • EPG Electronic Program Guide
  • the EPG obtains the user's information and stores it in the hash table hashmap.
  • the heartbeat period of the EPG and the terminal is generally 15 minutes.
  • the EPG updates the login time of the terminal to the latest heartbeat time and stores it in the hashmap.
  • the EPG periodically compares the current time with the last login time of the terminal. If the time interval is greater than 16 minutes, the current terminal user is considered offline.
  • the EPG is mainly used for the synchronization, display and broadcast control of IPTV program information data, it is a key part of the performance of the IPTV service.
  • the performance of the integrated EPG makes the heartbeat interaction interval between the EPG and the terminal longer, which leads to the delay of the user's online status update.
  • the user's online status cannot be known in real time.
  • a main object of the embodiments of the present invention is to provide a method, an apparatus, and a system for acquiring an end user state, which are intended to solve the technical problem of a user's online state update delay.
  • the embodiment of the present invention provides a terminal user state obtaining method, where the terminal user state acquiring method includes the following steps:
  • the step of receiving the access request of the terminal, acquiring the terminal information according to the access request, and accessing the terminal includes:
  • the terminal is accessed.
  • the step of acquiring the state of the terminal according to the terminal information and the heartbeat message interaction state includes:
  • the heartbeat message interaction status is within the heartbeat period, and receives a heartbeat message that is sent by the terminal, setting the state of the terminal to be online according to the terminal information;
  • the state of the terminal is set to be offline according to the terminal information.
  • the method further includes:
  • heartbeat message interaction status is an offline message received by the terminal, setting the status of the terminal to offline.
  • the method further includes:
  • the execution step is: establishing a heartbeat message interaction with the terminal according to a preset heartbeat period.
  • an embodiment of the present invention further provides an apparatus for acquiring an end user status, where the apparatus for acquiring an end user status includes:
  • An access module configured to receive an access request of the terminal, acquire terminal information according to the access request, and access the terminal;
  • the heartbeat module is configured to establish a heartbeat message interaction with the terminal according to a preset heartbeat period
  • a status module configured to acquire a status of the terminal according to the terminal information and the heartbeat message interaction status.
  • the access module includes:
  • a receiving unit configured to receive an access request of the terminal, and acquire terminal information according to the access request
  • a verification unit configured to check whether the terminal is legally accessed according to the terminal information
  • the access unit is configured to access the terminal if the terminal is legally accessed.
  • the status module includes:
  • An interaction unit configured to push a heartbeat message to the terminal according to the heartbeat period and connect Receiving a heartbeat message responded by the terminal, and acquiring an interaction state of the heartbeat message;
  • a setting unit configured to: if the heartbeat message interaction state is within the heartbeat period, and receive a heartbeat message that is sent by the terminal, set the state of the terminal to be online according to the terminal information; if the heartbeat The message interaction state is that the heartbeat message that the terminal responds to is not received within the heartbeat period and the preset timeout period, and the state of the terminal is set to be offline according to the terminal information.
  • the setting unit is further configured to
  • heartbeat message interaction status is an offline message received by the terminal, setting the status of the terminal to offline.
  • the status module further includes:
  • the abnormal unit is configured to send a heartbeat to the terminal if the heartbeat message interaction state is that the heartbeat message is abnormally sent to the terminal, and the push of the heartbeat message to the terminal is successfully resumed within a preset abnormal time. Enter the message.
  • an embodiment of the present invention further provides an end user status acquisition system, where the terminal user status acquisition system includes a message interaction system MES system, a terminal, and an interactive network television IPTV system, where:
  • the MES system includes an access server and a push server;
  • the access server is configured to receive an access request of the terminal, obtain terminal information according to the access request, and check whether the terminal is legally accessed according to the terminal information; And accessing the terminal;
  • the push server is configured to establish a heartbeat message interaction with the terminal according to a preset heartbeat period, and acquire a state of the terminal according to the terminal information and the heartbeat message interaction state;
  • the terminal is configured to initiate an access request to the MES system, and establish a heartbeat message interaction with the MES system;
  • the IPTV system is configured to provide the MES system with a verification service for whether the terminal is legally accessed.
  • a computer storage medium is further provided, and the computer storage medium may store an execution instruction, where the execution instruction is used to execute the terminal user state acquisition method in the foregoing embodiment.
  • a method, device, and system for acquiring an end user state according to an embodiment of the present invention, receiving an access request of a terminal through an MES system, acquiring terminal information according to an access request, and accessing the terminal; and then, according to a preset heartbeat period, The terminal establishes a heartbeat message interaction; and updates the state of the terminal according to the terminal information and the heartbeat message interaction state.
  • the invention can flexibly set the heartbeat period, and the MES system can interact with the heartbeat message of the terminal to obtain the online state of the terminal user in time, and perform the abnormal processing of the heartbeat message interaction, thereby realizing the heartbeat keep-alive for the terminal user and obtaining the terminal user in real time. status.
  • FIG. 1 is a schematic flowchart of a method for acquiring a terminal user state according to a first embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a second embodiment of a method for acquiring an end user state according to the present invention
  • FIG. 3 is a schematic flowchart of a method for acquiring a terminal user state according to a third embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a method for acquiring a terminal user state according to a fourth embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a fifth embodiment of a method for acquiring an end user state according to the present invention.
  • FIG. 6 is a schematic diagram of functional modules of a first embodiment of an apparatus for acquiring a terminal user state according to the present invention
  • FIG. 7 is a schematic diagram of functional modules of a second embodiment of a terminal user state obtaining apparatus according to the present invention.
  • FIG. 8 is a schematic diagram of functional modules of a third embodiment and a fourth embodiment of an apparatus for acquiring a terminal user state according to the present invention.
  • FIG. 9 is a schematic diagram of functional modules of a fifth embodiment of a terminal user state obtaining apparatus according to the present invention.
  • FIG. 10 is a schematic block diagram of a first embodiment of a terminal user state obtaining system according to the present invention.
  • FIG. 11 is a schematic flowchart of an application scenario for acquiring an IPTV terminal user state according to an embodiment of the present invention.
  • the main solution of the embodiment of the present invention is: receiving an access request of the terminal, acquiring terminal information according to the access request, and accessing the terminal; and establishing a heartbeat message interaction with the terminal according to a preset heartbeat period; The terminal information and the heartbeat message exchange state, and the state of the terminal is updated.
  • the related technology acquires the state of the terminal user, and mainly interacts with the heartbeat of the terminal through the IPTV system.
  • the heartbeat message interaction interval is long, and the terminal user's online state update is delayed, and the online state of the terminal user cannot be known in real time.
  • the present invention provides a solution, and provides an MES system, which can update the online status of the terminal user in time and obtain the status of the terminal user in real time by performing heartbeat preservation with the terminal user.
  • a first embodiment of an end user state obtaining method of the present invention provides a method for acquiring an end user state, where the method for obtaining an end user state includes:
  • Step S10 Receive an access request of the terminal, acquire terminal information according to the access request, and access the terminal.
  • the embodiment of the present invention acquires the real-time status of the terminal user through the MES system (Message Exange System), and is mainly applied to the update or statistics of the real-time status of the interactive network television IPTV terminal user, and can also be used for real-time status of other users. Updates or statistics can be flexibly applied according to actual needs.
  • the IPTV terminal may be an STB (Set-Top-Box), a PC (personal computer), a Pad, a mobile phone, or the like.
  • the MES system configures a domain address Domain in the IPTV system in advance, and the domain is an address and a port of the current terminal accessing the MES system.
  • IPTV terminal user After the IPTV terminal user starts, a login request is initiated to the IPTV system.
  • the IPTV system verifies the account of the terminal user. If the current terminal user is a legitimate user, the current terminal user is allowed to log in successfully. Then, the IPTV system delivers the domain to the current terminal.
  • the terminal After the terminal user successfully logs in to the IPTV system, the terminal obtains the domain delivered by the IPTV system, and initiates a login registration request to the MES system according to the domain.
  • the MES system includes an access server and a push server.
  • the access server may be used for the access terminal to interact with the IPTV system, and may have an alternate access server, where the domain is a domain address that points to the access server; the push server may be used to establish a heartbeat message interaction with the terminal to keep alive. .
  • the access server receives the login registration request of the terminal, that is, the access request, and acquires the terminal information.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the terminal information may be account information of the terminal user, used to identify different terminal users, and may determine the current terminal user uniquely according to the account information.
  • the terminal information may of course be other information that can identify different terminal users, and can be flexibly set according to actual needs.
  • the access server accesses the terminal through the access request of the current terminal, and allocates a push server to the current terminal. To ensure load balancing, the access server selects the push server with the lightest load currently assigned to the current terminal according to the load status of the current push server. The access server returns the domain address of the least-push push server to the current terminal.
  • Step S20 Establish a heartbeat message interaction with the terminal according to a preset heartbeat period.
  • the push server After receiving the access request of the terminal and acquiring the terminal information, the push server establishes a heartbeat message interaction with the terminal.
  • the terminal initiates a registration report request to the push server according to the domain address returned by the access server.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the push server receives the registration report request of the terminal, registers the terminal, acquires and stores Terminal information.
  • the push server After the registration is successful, the push server starts to perform heartbeat message interaction with the terminal according to the preset heartbeat period.
  • the heartbeat established by the push server and the terminal may be an HTTP protocol heartbeat or a UDP protocol heartbeat, and may be flexibly set according to the actual situation of the terminal. For example, if the PC terminal uses the HTTP protocol heartbeat, the push server establishes an HTTP link with the PC terminal. STB, Pad, and mobile phones use the UDP protocol heartbeat, and the push server establishes a UDP link with the STB, Pad, or mobile phone.
  • the push server After the terminal interacts with the heartbeat message of the push server, the push server periodically pushes the heartbeat message to the terminal according to the preset heartbeat period. After receiving the heartbeat message pushed by the push server, the terminal sends a heartbeat message to the push server during the preset heartbeat period to perform heartbeat message interaction.
  • the preset heartbeat period refers to the number of interactions between the MES system and the preset heartbeat message preset by the MES system, which is adjustable. For example, if the heartbeat period is set to 1 minute, then every 1 minute.
  • the push server interacts with the terminal for a heartbeat message.
  • the heartbeat message is a preset format of the message format, and the field format of the heartbeat message can be pre-configured and flexibly set.
  • Step S30 Acquire a state of the terminal according to the terminal information and the heartbeat message interaction state.
  • the push server After the push server and the terminal establish a heartbeat message interaction, the push server updates the state of the terminal in real time according to the terminal information and the real-time heartbeat message interaction state.
  • the push server sets or updates the terminal status corresponding to the terminal information according to the heartbeat message interaction status.
  • the push server determines that the current terminal user is online, and sets the terminal status corresponding to the current terminal information to online.
  • the push server and the terminal do not successfully perform heartbeat message interaction during the heartbeat period, then The interaction is abnormal for the current heartbeat message. If the heartbeat message of the push server is pushed normally, if the push server still fails to perform the heartbeat message interaction with the terminal successfully within the preset timeout period, the push server determines that the current terminal user is offline, and updates the terminal status corresponding to the current terminal information. Offline.
  • the push server can acquire the state of the terminal in real time.
  • the MES system receives the access request of the terminal, accesses the terminal according to the access request, and acquires the terminal information; and then, according to the preset heartbeat period, establishes a heartbeat message interaction with the terminal; and interacts with the heartbeat message according to the terminal information.
  • Status update the status of the terminal.
  • the heartbeat period is flexibly set, and the MES system interacts with the heartbeat message of the terminal, so that the online state of the terminal user can be obtained in time, and the abnormality of the heartbeat message interaction is performed, and the heartbeat keepalive is performed on the terminal user, and the terminal user is obtained in real time. status.
  • the second embodiment of the method for acquiring the end user state of the present invention provides a method for acquiring the state of the terminal user.
  • the step S10 includes:
  • Step S11 Receive an access request of the terminal, and acquire terminal information according to the access request.
  • the MES system After the terminal sends a login registration request to the MES system, that is, after the access request, the MES system receives the access request of the terminal.
  • the access server receives the login registration request of the terminal.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the terminal information may be account information of the terminal user, used to identify different terminal users, and may determine the current terminal user uniquely according to the account information.
  • the terminal information may of course be other information that can identify different terminal users, and can be flexibly set according to actual needs.
  • Step S12 Verify, according to the terminal information, whether the terminal is a legitimate access.
  • the access server initiates a verification request to the IPTV system, and the IPTV system checks whether the current terminal is a legitimate access.
  • the verification request sent by the access server carries the current terminal's letter.
  • the IPTV system determines whether the current terminal user is a legitimate user according to the current terminal user's account information.
  • the verification result is returned to the access server.
  • the access server determines that the current terminal is a legitimate access; if the current terminal user is an illegal user of the IPTV system, the access server determines that the current terminal is an illegal access.
  • the access server obtains a determination result of whether the current terminal is a legitimate access.
  • Step S13 If the terminal is a legal access, access the terminal.
  • the access server allows the login registration of the current terminal to access the current terminal.
  • the push server with the lightest current load is selected and assigned to the current terminal.
  • the access server returns the domain address of the least-push push server to the current terminal.
  • the terminal initiates a registration report request to the push server according to the domain address returned by the access server.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the push server receives the registration report request of the terminal, acquires the terminal information, and stores the acquired terminal information.
  • the push server interacts with the current terminal to establish a heartbeat message according to the preset heartbeat period, and acquires the state of the current terminal in real time.
  • the access server does not pass the login registration request of the current terminal, and rejects the current access request of the current terminal.
  • the MES system receives the access request of the terminal, acquires the terminal information according to the access request, and verifies whether the terminal is a legitimate access according to the terminal information; and if the terminal is a legal access, the access terminal.
  • the verification of the access terminal ensures the security of the MES system, avoids the occupation of server resources, and improves the efficiency of real-time state acquisition of the terminal user.
  • a third embodiment of the method for acquiring an end user state of the present invention provides a method for acquiring an end user state, which is based on the embodiment shown in FIG. 1 or FIG. 2 (the present invention uses FIG. 2 as an example).
  • Step S30 includes:
  • Step S31 Push a heartbeat message to the terminal according to the heartbeat period, and receive a heartbeat message that is sent by the terminal to obtain the heartbeat message interaction state.
  • the push server acquires the heartbeat message interaction status of the terminal.
  • the push server periodically pushes a heartbeat message to the current terminal.
  • the heartbeat interaction state of the current terminal is obtained.
  • the push server normally pushes the heartbeat message during the heartbeat period and receives the heartbeat message of the current terminal response, the heartbeat message interaction status of the current terminal is normal.
  • the heartbeat message of the current terminal is in an abnormal state, such as network delay and terminal passive forced offline.
  • the push server records the time node at which the current terminal heartbeat message interaction is abnormal.
  • the push server obtains the heartbeat interaction state of the current terminal.
  • Step S32 If the heartbeat message interaction state is within the heartbeat period, and receives a heartbeat message that is sent by the terminal, set the state of the terminal to be online according to the terminal information.
  • the heartbeat message of the current terminal is in a normal state.
  • the push server sets the state corresponding to the current terminal information to online according to the terminal information of the current terminal.
  • the push server receives the heartbeat message of the current terminal response again after the timeout node of the current terminal heartbeat message interaction occurs, and the preset timeout period, the current terminal's interaction state is normal, and the current terminal state is maintained online. Filters individual heartbeat cycle anomalies caused by network congestion and other reasons.
  • Step S33 If the heartbeat message interaction state is that the heartbeat message responded by the terminal is not received within the heartbeat period and the preset timeout period, set the state of the terminal according to the terminal information. Offline.
  • the heartbeat message of the current terminal is in an abnormal state, for example, the terminal is forced to be offline.
  • the push server determines that the current terminal is offline. Then, the push server sets the state corresponding to the current terminal information to offline according to the current terminal information.
  • the preset timeout period is the abnormal time of the terminal. If the heartbeat message of the terminal response is not received after the preset timeout period exceeds, the terminal is determined to be abnormal.
  • the preset timeout period can be flexibly set according to actual needs.
  • the push server acquires the state of the terminal in real time.
  • the MES system sends a heartbeat message to the terminal according to the heartbeat period, and receives a heartbeat message that the terminal responds to obtain a heartbeat message interaction state. If the heartbeat message interaction state is within the heartbeat period, the heartbeat message of the terminal response is received. According to the current terminal information, the current terminal state is set to be online; if the heartbeat message interaction state is not received by the terminal in the heartbeat period and the preset timeout period, the current terminal information is set according to the current terminal information. The state of the terminal is offline, whereby the MES system acquires the state of the terminal. In this embodiment, the heartbeat keepalive is performed on the terminal according to the heartbeat message interaction state of the terminal, and the state of the terminal is updated in real time according to the terminal information, so that the state of the terminal is obtained in real time.
  • the fourth embodiment of the method for acquiring the terminal user state of the present invention provides a method for acquiring the state of the terminal user. After the step S31, the method further includes:
  • Step S34 If the heartbeat message interaction state is an offline message of the terminal, set the state of the terminal to be offline.
  • the push server pushes the heartbeat message to the terminal and receives the heartbeat message responded by the terminal, and acquires the heartbeat message interaction status of the terminal.
  • the terminal actively sends an offline message to the push server.
  • the push server After receiving the offline message of the terminal, the push server updates the state of the terminal corresponding to the current terminal information to offline according to the information of the current terminal, and ends the interaction with the heartbeat message of the current terminal.
  • the state of the terminal is set to be offline.
  • the state of the terminal is updated in real time, and the real-time state of the terminal is obtained.
  • the fifth embodiment of the terminal user state obtaining method of the present invention provides a terminal user state obtaining method. After the step S31, the method further includes:
  • Step S35 If the heartbeat message interaction state is that the heartbeat message is abnormally sent to the terminal, and the push to the terminal heartbeat message is successfully resumed within a preset abnormal time, the heartbeat access message is sent to the terminal. And proceeds to step S20.
  • the push server pushes the heartbeat message abnormally to the terminal, and the heartbeat message cannot be successfully pushed to the terminal.
  • the preset abnormal time is After the service of the MES system is restored, the heartbeat message can be successfully sent to the terminal.
  • the push server sends an access message to the terminal.
  • the terminal After receiving the access message of the push server, the terminal initiates a registration access request to the push server.
  • the push server interacts with the terminal to establish a heartbeat message according to a preset heartbeat period.
  • the terminal sends a login registration request, that is, an access request, to the MES system access server to re-acquire the MES system service.
  • the preset abnormal time is the abnormal time of the MES system service. If the abnormal time of the MES system service exceeds the preset abnormal time, it is determined that the MES system service is abnormal.
  • the preset abnormal time can be flexibly set according to actual needs.
  • the heartbeat message interaction state is that the MES system pushes the heartbeat message abnormality to the terminal, and the MES system successfully restores the push to the terminal heartbeat message within the preset abnormal time
  • the heartbeat access message is sent to the terminal
  • the terminal establishes a heartbeat message interaction with the terminal to prevent the terminal from repeatedly accessing the MES system, thereby realizing the processing of the transient abnormal situation in the real-time state acquisition process of the terminal user, and improving the processing efficiency of the real-time state acquisition of the terminal user.
  • the first embodiment of the terminal user state obtaining apparatus of the present invention provides an apparatus for acquiring an end user state, where the terminal user state obtaining apparatus includes:
  • the access module 100 is configured to receive an access request of the terminal, acquire terminal information according to the access request, and access the terminal.
  • the embodiment of the present invention acquires the real-time status of the terminal user by using the terminal user state obtaining device.
  • the terminal user state acquiring device is located in the MES system (Message Exange System), and is mainly used for updating the real-time status of the interactive network television IPTV terminal user or Statistics, of course, can also be used for the update or statistics of other users' real-time status, and can be flexibly applied according to actual needs.
  • the IPTV terminal may be an STB (Set-Top-Box), a PC (personal computer), a Pad, a mobile phone, or the like.
  • the access module 100 configures a domain address Domain in the IPTV system in advance, and the domain is an address and a port of the current terminal accessing the access module 100.
  • IPTV terminal user After the IPTV terminal user starts, a login request is initiated to the IPTV system. IPTV system school If the current terminal user is a legitimate user, the current terminal user is allowed to log in successfully. Then, the IPTV system delivers the domain to the current terminal.
  • the terminal After the terminal user successfully logs in to the IPTV system, the terminal acquires the domain that is delivered by the IPTV system, and initiates a login registration request to the access module 100 according to the domain.
  • the access module 100 receives the login registration request of the terminal, that is, the access request, and acquires the terminal information.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the terminal information may be account information of the terminal user, used to identify different terminal users, and may determine the current terminal user uniquely according to the account information.
  • the terminal information may of course be other information that can identify different terminal users, and can be flexibly set according to actual needs.
  • the access module 100 accesses the terminal through the access request of the current terminal, and allocates the heartbeat module 200 to the current terminal. To ensure load balancing, the access module 100 selects the heartbeat module 200 with the lightest current load to allocate to the current terminal according to the load status of the current heartbeat module 200. The access module 100 returns the domain address of the load minimum heartbeat module 200 to the current terminal.
  • the heartbeat module 200 is configured to establish a heartbeat message interaction with the terminal according to a preset heartbeat period.
  • the heartbeat module 200 After receiving the access request of the terminal and acquiring the terminal information, the heartbeat module 200 establishes a heartbeat message interaction with the terminal.
  • the terminal initiates a registration report request to the heartbeat module 200 according to the domain address returned by the access server.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the heartbeat module 200 receives the registration report request of the terminal, registers the terminal, and acquires and stores the terminal information.
  • the heartbeat module 200 After the registration is successful, the heartbeat module 200 starts to perform heartbeat message interaction with the terminal according to the preset heartbeat period.
  • the heartbeat established by the heartbeat module 200 and the terminal may be an HTTP protocol heartbeat or a UDP protocol heartbeat, and may be flexibly set according to the actual situation of the terminal, for example, a PC terminal adopts With the HTTP protocol heartbeat, the heartbeat module 200 establishes an HTTP link with the PC terminal; the STB, the Pad, and the mobile phone use the UDP protocol heartbeat, and the heartbeat module 200 establishes a UDP link with the STB, the Pad, or the mobile phone.
  • the heartbeat module 200 After the terminal is established with the heartbeat message of the heartbeat module 200, the heartbeat module 200 periodically pushes the heartbeat message to the terminal according to the preset heartbeat period. After receiving the heartbeat message pushed by the heartbeat module 200, the terminal sends a heartbeat message to the heartbeat module 200 during the preset heartbeat period to perform heartbeat message interaction.
  • the preset heartbeat period refers to the number of times the heartbeat module 200 interacts with the preset heartbeat message of the terminal in a preset time period, which is adjustable. For example, if the heartbeat period is set to 1 minute, then every 1 time. Minutes, the heartbeat module 200 interacts with the terminal for a heartbeat message.
  • the heartbeat message is a preset format of the message format, and the field format of the heartbeat message can be pre-configured and flexibly set.
  • the status module 300 is configured to acquire the status of the terminal according to the terminal information and the heartbeat message interaction status.
  • the state module 300 updates the state of the terminal in real time according to the terminal information and the real-time heartbeat message interaction state.
  • the status module 300 sets or updates the terminal status corresponding to the terminal information according to the heartbeat message interaction status.
  • the state module 300 determines that the current terminal user is online, and sets the terminal state corresponding to the current terminal information to be online.
  • the state module 300 determines that the current heartbeat message interaction is abnormal. If the heartbeat message of the heartbeat module 200 is pushed normally, if the heartbeat module 200 still fails to perform the heartbeat message interaction with the terminal successfully within the preset timeout period, the state module 300 determines that the current terminal user is offline and corresponds to the current terminal information. The terminal status is updated to offline.
  • the status module 300 can acquire the status of the terminal in real time.
  • the access module 100 receives the access request of the terminal, accesses the terminal according to the access request, and acquires the terminal information. Then, the heartbeat module 200 establishes a heartbeat message interaction with the terminal according to the preset heartbeat period; 300 updates the state of the terminal according to the terminal information and the heartbeat message interaction status.
  • the heartbeat period is flexibly set, and the terminal user state acquiring device interacts with the heartbeat message of the terminal, so that the online state of the terminal user can be obtained in time, and the abnormality of the heartbeat message interaction is performed, thereby realizing the heartbeat keep-alive for the terminal user, real-time Get the status of the end user.
  • the access module 100 includes:
  • the receiving unit 110 is configured to receive an access request of the terminal, and acquire terminal information according to the access request.
  • the receiving unit 110 After the terminal sends a login registration request to the MES system, that is, after the access request, the receiving unit 110 receives the access request of the terminal.
  • the receiving unit 110 receives a login registration request of the terminal.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the terminal information may be account information of the terminal user, used to identify different terminal users, and may determine the current terminal user uniquely according to the account information.
  • the terminal information may of course be other information that can identify different terminal users, and can be flexibly set according to actual needs.
  • the verification unit 120 is configured to check whether the terminal is legally accessed according to the terminal information.
  • the verification unit 120 initiates a verification request to the IPTV system, and the IPTV system checks whether the current terminal is a legitimate access.
  • the verification request sent by the verification unit 120 carries the current terminal information for the IPTV system to check. For example, the IPTV system determines whether the current terminal user is a legitimate user according to the current terminal user's account information.
  • the verification result is returned to the verification unit 120.
  • the verification unit 120 determines that the current terminal is a legitimate access; if the current terminal user is an illegal user of the IPTV system, the verification unit 120 determines that the current terminal is an illegal access.
  • the verification unit 120 obtains a determination result of whether the current terminal is a legitimate access.
  • the access unit 130 is configured to access the terminal if the terminal is a legal access.
  • the access unit 130 allows the login registration of the current terminal to intervene in the current terminal.
  • the access unit 130 selects the heartbeat module 200 with the lightest current load to allocate to the current terminal according to the load condition of the current heartbeat module 200.
  • the access unit 130 returns the domain address of the load minimum heartbeat module 200 to the current terminal.
  • the terminal initiates a registration report request to the heartbeat module 200 according to the domain address returned by the access unit 130.
  • the registration report request sent by the terminal carries the information of the current terminal.
  • the heartbeat module 200 receives the registration report request of the terminal, acquires the terminal information, and stores the acquired terminal information.
  • the heartbeat module 200 establishes a heartbeat message interaction with the current terminal according to the preset heartbeat period, and acquires the state of the current terminal in real time.
  • the access unit 130 does not pass the login registration request of the current terminal, and rejects the current access request of the current terminal.
  • the receiving unit 110 receives the access request of the terminal, and acquires the terminal information according to the access request.
  • the checking unit 120 verifies whether the terminal is legally accessed according to the terminal information; if the terminal is legally accessed, the access is performed.
  • Unit 130 accesses the terminal. In this embodiment, the verification of the access terminal ensures the security of the real-time state acquisition device of the terminal user, avoids the occupation of server resources, and improves the efficiency of real-time state acquisition of the terminal user.
  • the state module 300 includes:
  • the interaction unit 310 is configured to: according to the heartbeat period, push a heartbeat message to the terminal and receive a heartbeat message that is sent by the terminal, and acquire the heartbeat message interaction state.
  • the state module 300 acquires the heartbeat interaction state of the terminal.
  • the interaction unit 310 periodically pushes a heartbeat message to the current terminal.
  • the state of the heartbeat interactive message of the current terminal is obtained.
  • the interaction unit 310 normally pushes the heartbeat message and receives the heartbeat message of the current terminal response, the heartbeat message interaction state of the current terminal is normal.
  • the heartbeat message is normally sent by the interaction unit 310 in the heartbeat period, but the heartbeat message of the current terminal is not received, the heartbeat message of the current terminal is in an abnormal state, such as a network delay, a terminal passive forced offline, and the like.
  • the interaction unit 310 records a time node in which the current terminal heartbeat message interaction is abnormal.
  • the interaction unit 310 obtains the heartbeat interaction state of the current terminal.
  • the setting unit 320 is configured to: if the heartbeat message interaction status is within the heartbeat period, and receive a heartbeat message that is sent by the terminal, set the state of the terminal to be online according to the terminal information;
  • the heartbeat message interaction state is that the heartbeat message responded by the terminal is not received within the heartbeat period and the preset timeout period, and the state of the terminal is set to be offline according to the terminal information.
  • the interaction unit 310 normally pushes the heartbeat message and receives the heartbeat message that the current terminal responds, the heartbeat message interaction state of the current terminal is normal.
  • the setting unit 320 sets the state corresponding to the current terminal information to be online according to the terminal information of the current terminal.
  • the interaction unit 310 receives the heartbeat message of the current terminal response again after the timeout node in which the current terminal heartbeat message interaction is abnormal, and the preset timeout period, the current terminal is determined.
  • the interaction state is normal, and the setting unit 320 keeps the state of the current terminal online, and filters an abnormality of an individual heartbeat cycle caused by network congestion or the like.
  • the interaction unit 310 normally pushes the heartbeat message, but does not receive the heartbeat message of the current terminal response, the heartbeat message interaction status of the current terminal is abnormal, for example, the terminal is forced to be offline.
  • the interaction unit 310 does not receive the heartbeat message of the current terminal response after the timeout period of the abnormality of the current terminal heartbeat message interaction and the preset timeout period, the current terminal is determined to be offline. Then, the setting unit 320 sets the state corresponding to the current terminal information to offline according to the current terminal information.
  • the preset timeout period is the abnormal time of the terminal. If the heartbeat message of the terminal response is not received after the preset timeout period exceeds, the terminal is determined to be abnormal.
  • the preset timeout period can be flexibly set according to actual needs.
  • the setting unit 320 acquires the state of the terminal in real time.
  • the interaction unit 310 pushes the heartbeat message to the terminal according to the heartbeat period, and receives the heartbeat message that the terminal responds to obtain the heartbeat message interaction state. If the heartbeat message interaction state is within the heartbeat period, the heartbeat message received by the terminal is received.
  • the setting unit 320 sets the state of the current terminal to be online according to the current terminal information; if the heartbeat message interaction state is that the heartbeat message of the terminal response is not received within the heartbeat period and the preset timeout period, the setting unit 320 According to the current terminal information, the state of the current terminal is set to be offline, and thus the MES system acquires the state of the terminal.
  • the terminal user real-time state obtaining device performs heartbeat preservation on the terminal according to the heartbeat message interaction state of the terminal, and updates the state of the terminal in real time according to the terminal information, thereby realizing the state of acquiring the terminal in real time.
  • the fourth embodiment of the terminal user state obtaining apparatus of the present invention provides an apparatus for acquiring terminal state, which is based on the third embodiment of the terminal user state obtaining apparatus of the present invention shown in FIG. 320 is also set to,
  • the interaction unit 310 pushes a heartbeat message to the terminal and receives a heartbeat message that the terminal responds to obtain a heartbeat message interaction state of the terminal.
  • the terminal actively sends an offline message to the interaction unit 310.
  • the setting unit 320 updates the state of the terminal corresponding to the current terminal information to offline according to the information of the current terminal, and ends the interaction with the heartbeat message of the current terminal.
  • the setting unit 320 sets the state of the terminal to be offline.
  • the real-time state acquiring device of the terminal user updates the state of the terminal in real time, thereby realizing the acquisition of the real-time state of the terminal.
  • the fifth embodiment of the terminal user state obtaining apparatus of the present invention provides a terminal user state obtaining apparatus, which is based on the fourth embodiment of the terminal user state obtaining apparatus of the present invention shown in FIG. 300 also includes:
  • the abnormal unit 330 is configured to send to the terminal if the heartbeat message interaction state is that the heartbeat message is abnormally sent to the terminal, and the push of the heartbeat message to the terminal is successfully resumed within a preset abnormal time. Heartbeat access message.
  • the heartbeat message interaction state is abnormal, for example, the interaction unit 310 pushes the heartbeat message abnormally to the terminal, and cannot successfully push the heartbeat message to the terminal.
  • the preset abnormal time is within an abnormal time
  • the heartbeat message can be successfully sent to the terminal.
  • the abnormal unit 330 sends an access message to the terminal.
  • the terminal After receiving the access message of the abnormal unit 330, the terminal initiates a registration access request to the heartbeat module 200.
  • the heartbeat module 200 interacts with the terminal to establish a heartbeat message according to a preset heartbeat period.
  • the terminal sends a login registration request, that is, an access request, to the access module 100 to re-acquire the service.
  • the preset abnormal time is the abnormal time of the interaction unit 310. If the abnormal time of the interaction unit 310 exceeds the preset abnormal time, it is determined that the interaction unit 310 is abnormal.
  • the preset abnormal time can be flexibly set according to actual needs.
  • the abnormal unit 330 sends the heartbeat message to the terminal.
  • the heartbeat access message, the heartbeat module 200 re-establishes a heartbeat message interaction with the terminal according to the preset heartbeat period, and prevents the terminal from repeatedly accessing the access module 100, thereby realizing the processing of the transient abnormal situation in the real-time state acquisition process of the terminal user. Improve the processing efficiency of the end user real-time status acquisition.
  • the terminal user state obtaining system of the present invention provides an end user state acquiring system, which includes a message interaction system MES system A, a terminal B, and an interactive network television IPTV system C, wherein:
  • the MES system A includes an access server A1 and a push server A2;
  • the access server A1 is configured to receive an access request of the terminal B, obtain terminal information according to the access request, and check whether the terminal B is legally accessed according to the terminal information; For legal access, access to the terminal B;
  • the push server A2 is configured to establish a heartbeat message interaction with the terminal B according to a preset heartbeat period, and acquire the state of the terminal B according to the terminal B information and the heartbeat message interaction state.
  • the embodiment of the present invention acquires the real-time status of the IPTV terminal B user through the MES system A (Message Exange System).
  • MES system A Message Exange System
  • the terminal B logs in to the IPTV system C, it actively registers with the MES system A. After the access succeeds, the heartbeat message is kept alive, and the terminal B exits.
  • the offline message is actively sent to the MES system A, and the MES system A sets the state of the terminal B to offline.
  • the MES system A includes an access server A1 and a push server A2.
  • the acquisition of the IPTV terminal user status is exemplified.
  • the access server A1 may include a primary access server and an alternate access server, receive an access request of the terminal B, and acquire information of the terminal B.
  • the access server A1 transmits a verification request to the IPTV system C based on the information of the terminal B.
  • the IPTV system C verifies whether the terminal B is a legitimate user according to the information of the terminal B, and returns the verification result to the access server A1.
  • terminal B is an illegal user
  • terminal B is an illegal access
  • access server A1 rejects the access request of terminal B.
  • the terminal B is a legitimate user, the terminal B is a legal access, and the access server A1 accesses the access request of the terminal B and accesses the terminal B through the access request of the terminal B.
  • the access server A1 pushes the server A2 to perform load balancing. According to the load status of the current push server A2, the push server with the lightest load is selected and assigned to the terminal B for establishing heartbeat message interaction with the terminal B. The access server A1 returns the domain address Domain of the assigned push server A2 to the terminal B.
  • the terminal B transmits a registration report request to the push server A2 according to the received domain address Domain of the push server A2.
  • the push server A2 After receiving the registration report request of the terminal B, the push server A2 establishes a heartbeat message interaction with the terminal B according to the registration report request of the terminal B, and responds to the registration report request of the terminal B.
  • the push server A2 maintains a heartbeat message interaction with the terminal B according to a preset heartbeat period.
  • the push server A2 acquires the state of the terminal B according to the information of the terminal B and the state of the heartbeat message interaction. For example, the push server A2 sends a heartbeat message to the terminal B, and receives the heartbeat message responded by the terminal B in the heartbeat period, and sets the state of the terminal B to be online according to the information of the terminal B; if the heartbeat period and the preset timeout No heartbeat received by Terminal B during the time The message is updated according to the information of the terminal B, and the status of the terminal B is offline.
  • the push server A2 sends a heartbeat access message to the terminal B after the service is restored, and establishes a heartbeat message interaction with the terminal B to perform a heartbeat.
  • the message is kept alive.
  • the access server A1 is further configured to receive a message to be pushed from a third-party platform, and the push server A2 pushes the message to the terminal B.
  • the terminal B is configured to initiate an access request to the MES system A, and establish a heartbeat message interaction with the MES system A.
  • the terminal B includes an STB (Set-Top-Box), a PC (personal computer) .
  • the terminal B After the startup is started, the terminal B initiates a login request to the IPTV system C. After the login is successful, the domain address Domain of the MES system A returned by the IPTV system C is obtained.
  • the terminal B sends a login registration request, that is, an access request, to the MES system A according to the Domain, requesting access to the MES system A.
  • the access request sent by the terminal B carries the information of the terminal B.
  • the registration report request is sent to the MES system A according to the domain address returned by the MES system A.
  • the registration report request sent by the terminal B carries the information of the terminal B.
  • the terminal B After the MES system A interacts with the establishment of the heartbeat message of the terminal B, the terminal B sends a heartbeat message to the MES system A according to the preset heartbeat period, and maintains the heartbeat message interaction with the MES system A to keep the heartbeat message keep alive.
  • the terminal B exceeds the preset response time and does not receive the heartbeat message of the MES system A, the re-access request is sent to the access server A1, and the push server A2 re-allocated by the access server A1 establishes a heartbeat message with the terminal B.
  • the preset response time can be flexibly set according to actual needs.
  • the IPTV system C is configured to provide the MES system A with a verification service for whether the terminal B is legally accessed.
  • the IPTV system C interacts with the terminal B and the MES system A through the portal system EPG (Electronic Program Guide).
  • EPG Electronic Program Guide
  • the IPTV system C determines whether the terminal B is a legitimate user according to the user registration table in the database.
  • the terminal B is an illegal user, the terminal B is prohibited from logging in to the IPTV system C.
  • the terminal B is allowed to log in to the IPTV system C, and then the domain address Domain of the MES system A is returned to the terminal B.
  • the Domain is the address and port of the access server A1 of the pre-configured MES system A.
  • the MES system A After the terminal B initiates an access request to the MES system A, the MES system A acquires the information of the terminal B and initiates a verification request to the IPTV system C.
  • the IPTV system C verifies whether the terminal B is a legitimate user according to the verification request of the MES system A, and returns the verification result to the MES system A.
  • the terminal user status acquisition system includes the message interaction system MES system A, the terminal B, and the interactive network television IPTV system C.
  • the terminal B logs in to the IPTV system C
  • the terminal MBA system A is actively registered and accessed successfully.
  • the MES system A acquires the state of the terminal B according to the heartbeat message interaction state and the information of the terminal B; when the terminal B exits the login, it actively sends an offline message to the MES system A, and the MES system A sets the terminal state to offline.
  • the heartbeat keep-alive of the MES system and the end user is implemented, and the real-time state of the terminal user can be obtained.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • S3 Acquire the state of the terminal according to the terminal information and the heartbeat message interaction status.
  • the storage medium is further arranged to store program code for performing the following steps:
  • S1 Receive an access request of the terminal, and acquire terminal information according to the access request.
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the MES system receives the access request of the terminal, acquires the terminal information according to the access request, and accesses the terminal; and then, according to the preset heartbeat period, establishes a heartbeat message interaction with the terminal; according to the terminal information and the heartbeat The status of the message interaction, updating the status of the terminal.
  • the invention can flexibly set the heartbeat period, and the MES system can interact with the heartbeat message of the terminal to obtain the online state of the terminal user in time, and perform the abnormal processing of the heartbeat message interaction, thereby realizing the heartbeat keep-alive for the terminal user and obtaining the terminal user in real time. status.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明实施例公开了一种终端用户状态获取方法,该方法包括:接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;根据预设的心跳周期,与所述终端建立心跳消息交互;根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。本发明还公开了一种终端用户状态获取装置和系统。本发明实施例通过与终端的心跳消息交互,可以及时更新终端用户的状态,并进行心跳消息交互异常的处理,实现了对终端用户进行心跳保活,实时获取终端用户的状态。

Description

终端用户状态获取方法、装置和系统 技术领域
本发明涉及信息交互技术领域,尤其涉及一种终端用户状态获取方法、装置和系统。
背景技术
随着网络通信技术的发展,交互式网络电视IPTV依托于IP宽带网络,得到了快速的发展。作为一种新兴的传媒产业,IPTV具有交互性和实时性,将电视服务和互联网浏览、电子邮件收发及多种在线信息咨询、娱乐、教育、商务功能成功的进行了结合,使用户得到了高质量的数字媒体服务,受到了广大消费者的青睐。
随着IPTV节目与营销活动的增多,海内、外的IPTV市场发展迅速,单个家庭就存在多个IPTV终端,如STB(Set-Top-Box,机顶盒)、PC(personal computer,个人计算机)、Pad、手机等。为更准确地针对在线用户进行运维统计,广告、消息通知、投票等增值业务的推送,需获知IPTV当前用户的在线状态。
目前,主要通过终端与IPTV的门户系统EPG(Electronic Program Guide,电子节目指南)使用心跳机制保活,获取用户的在线状态。用户登录后,EPG获取用户的信息并存入哈希表hashmap。EPG与终端的心跳周期一般为15分钟,每次心跳后,EPG将终端的登录时间更新为最近一次心跳时间,并存入hashmap。EPG定时比较当前时间与终端的最近一次登录时间,若时间间隔大于16分钟,则认为当前终端用户离线。
由于EPG主要用于IPTV节目信息数据的同步、展示和播控等,是IPTV业务性能的关键部分,综合EPG的性能,使得EPG与终端的心跳交互时间间隔较长,导致用户在线状态更新的延迟,不能实时获知用户的在线状态。
发明内容
本发明实施例的主要目的在于提供一种终端用户状态获取方法、装置和系统,旨在解决用户在线状态更新延迟的技术问题。
为实现上述目的,本发明实施例提供一种终端用户状态获取方法,所述终端用户状态获取方法包括以下步骤:
接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;
根据预设的心跳周期,与所述终端建立心跳消息交互;
根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
可选的,所述接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端的步骤包括:
接收终端的接入请求,根据所述接入请求获取终端信息;
根据所述终端信息,校验所述终端是否为合法接入;
若所述终端为合法接入,则接入所述终端。
可选的,所述根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态的步骤包括:
根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态;
若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线;
若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
可选的,所述根据所述心跳周期,向所述终端推送心跳消息并接收所 述终端响应的心跳消息,获取所述心跳消息交互状态的步骤之后,还包括:
若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终端的状态为离线。
可选的,所述根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态的步骤之后,还包括:
若所述心跳消息交互状态为向所述终端推送心跳消息异常,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息,并转入执行步骤:根据预设的心跳周期,与所述终端建立心跳消息交互。
此外,为实现上述目的,本发明实施例还提供一种终端用户状态获取装置,所述终端用户状态获取装置包括:
接入模块,设置为接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;
心跳模块,设置为根据预设的心跳周期,与所述终端建立心跳消息交互;
状态模块,设置为根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
可选的,所述接入模块包括:
接收单元,设置为接收终端的接入请求,根据所述接入请求获取终端信息;
校验单元,设置为根据所述终端信息,校验所述终端是否为合法接入;
接入单元,设置为若所述终端为合法接入,则接入所述终端。
可选的,其特征在于,所述状态模块包括:
交互单元,设置为根据所述心跳周期,向所述终端推送心跳消息并接 收所述终端响应的心跳消息,获取所述心跳消息交互状态;
设置单元,设置为若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线;若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
可选的,所述设置单元还设置为,
若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终端的状态为离线。
可选的,所述状态模块还包括:
异常单元,设置为若所述心跳消息交互状态为向所述终端推送心跳消息异常,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息。
此外,为实现上述目的,本发明实施例还提供一种终端用户状态获取系统,所述终端用户状态获取系统包括消息交互系统MES系统、终端和交互式网络电视IPTV系统,其中:
所述MES系统,包括接入服务器和推送服务器;
所述接入服务器,设置为接收终端的接入请求,根据所述接入请求获取终端信息;根据所述终端信息,校验所述终端是否为合法接入;若所述终端为合法接入,则接入所述终端;
所述推送服务器,设置为根据预设的心跳周期,与所述终端建立心跳消息交互;根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态;
所述终端,设置为向所述MES系统发起接入请求,与所述MES系统建立心跳消息交互;
所述IPTV系统,设置为向所述MES系统提供所述终端是否合法接入的校验服务。
在本发明实施例中,还提供了一种计算机存储介质,该计算机存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的终端用户状态获取方法。
本发明实施例提出的一种终端用户状态获取方法、装置和系统,通过MES系统接收终端的接入请求,根据接入请求获取终端信息并接入终端;然后,根据预设的心跳周期,与终端建立心跳消息交互;根据终端信息和心跳消息交互状态,更新终端的状态。本发明灵活设置心跳周期,通过MES系统与终端的心跳消息交互,可以及时获取终端用户的在线状态,并进行心跳消息交互异常的处理,实现了对终端用户进行心跳保活,实时获取终端用户的状态。
附图说明
图1为本发明终端用户状态获取方法第一实施例的流程示意图;
图2为本发明终端用户状态获取方法第二实施例的流程示意图;
图3为本发明终端用户状态获取方法第三实施例的流程示意图;
图4为本发明终端用户状态获取方法第四实施例的流程示意图;
图5为本发明终端用户状态获取方法第五实施例的流程示意图;
图6为本发明终端用户状态获取装置第一实施例的功能模块示意图;
图7为本发明终端用户状态获取装置第二实施例的功能模块示意图;
图8为本发明终端用户状态获取装置第三实施例、第四实施例的功能模块示意图;
图9为本发明终端用户状态获取装置第五实施例的功能模块示意图;
图10为本发明终端用户状态获取系统第一实施例的模块示意图;
图11为本发明实施例中IPTV终端用户状态的获取应用场景流程示意 图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明实施例的主要解决方案是:接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;根据预设的心跳周期,与所述终端建立心跳消息交互;根据所述终端信息和所述心跳消息交互状态,更新所述终端的状态。
由于相关技术获取终端用户的状态,主要通过IPTV系统与终端的心跳交互,但是由于EPG的性能导致心跳消息交互时间间隔较长,终端用户在线状态更新延迟,不能实时获知终端用户的在线状态。
本发明提供一种解决方案,提出一种MES系统,通过与终端用户进行心跳保活,能够及时进行终端用户在线状态的更新,实时获取终端用户的状态。
参照图1,本发明终端用户状态获取方法第一实施例提供一种终端用户状态获取方法,所述终端用户状态获取方法包括:
步骤S10、接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端。
本发明实施例通过MES系统(Message Exange System,信息交互系统)获取终端用户的实时状态,主要应用于交互式网络电视IPTV终端用户实时状态的更新或统计,当然也可以用于其他用户实时状态的更新或统计,可根据实际需要灵活应用。IPTV终端可以是STB(Set-Top-Box,机顶盒)、PC(personal computer,个人计算机)、Pad、手机等。
具体的,作为一种实施方式,MES系统预先在IPTV系统配置域地址Domain,Domain为当前终端接入MES系统的地址和端口。
IPTV终端用户在启动后,向IPTV系统发起登录请求。IPTV系统校验终端用户的账号,若当前终端用户为合法用户,则允许当前终端用户成功登录。然后,IPTV系统向当前终端下发Domain。
终端用户成功登录IPTV系统后,终端获取IPTV系统下发的Domain,并根据Domain向MES系统发起登录注册请求。
MES系统包括接入服务器和推送服务器。其中,接入服务器可以用于接入终端,与IPTV系统交互,可以有备用接入服务器,Domain即为指向接入服务器的域地址;推送服务器可以用于与终端建立心跳消息交互,进行保活。
接入服务器接收终端的登录注册请求,也即接入请求,获取终端信息。
其中,终端发送的注册上报请求携带有当前终端的信息。其中,终端信息可以是终端用户的账户信息,用于标识不同的终端用户,可以根据账户信息唯一的确定当前终端用户。终端信息当然也可以是其他可以标识不同终端用户的信息,可根据实际需要灵活设置。
接入服务器通过当前终端的接入请求,接入终端,并给当前终端分配推送服务器。为保证负载均衡,接入服务器根据当前推送服务器的负载状况,选择当前负载最轻的推送服务器分配给当前终端。接入服务器将此负载最轻推送服务器的域地址返回给当前终端。
步骤S20、根据预设的心跳周期,与所述终端建立心跳消息交互。
在接收终端的接入请求,并获取终端信息后,推送服务器与终端建立心跳消息交互。
具体的,作为一种实施方式,终端根据接入服务器返回的域地址,向推送服务器发起注册上报请求。终端发送的注册上报请求携带有当前终端的信息。
推送服务器接收终端的注册上报请求,对终端进行注册,获取并存储 终端信息。
注册成功后,推送服务器根据预设的心跳周期,开始与终端进行心跳消息交互。
其中,推送服务器与终端建立的心跳可以是HTTP协议心跳,也可以是UDP协议心跳,可根据终端的实际情况灵活设置,例如:PC终端采用HTTP协议心跳,则推送服务器与PC终端建立HTTP链路;STB、Pad和手机采用UDP协议心跳,则推送服务器与STB、Pad或手机建立UDP链路。
在终端与推送服务器的心跳消息交互建立后,根据预设的心跳周期,推送服务器定时向终端推送心跳消息。终端在收到推送服务器推送的心跳消息后,在预设的心跳周期内,向推送服务器发送心跳消息,进行心跳消息交互。
需要说明的是,预设的心跳周期指预设的时间内,MES系统与终端预设的心跳消息交互次数,为可调配的,例如:设置心跳周期为1分钟1次,则每隔1分钟,推送服务器与终端进行一次心跳消息的交互。
其中,心跳消息为预设规范的消息格式,可预先配置心跳消息的字段格式,并进行灵活设置。
步骤S30、根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
在推送服务器与终端建立心跳消息交互后,推送服务器根据终端信息和实时的心跳消息交互状态,实时更新终端的状态。
具体的,作为一种实施方式,推送服务器根据心跳消息交互状态,设置或更新终端信息对应的终端状态。
若在心跳周期内,推送服务器与终端成功进行心跳消息交互,则推送服务器判定当前终端用户在线,并将当前终端信息对应的终端状态设置为在线。
若在心跳周期内,推送服务器与终端未成功进行心跳消息交互,则认 为当前心跳消息交互异常。若推送服务器的心跳消息推送正常,在预设的超时时间内,若推送服务器仍然未能与终端成功进行心跳消息交互,则推送服务器判定当前终端用户离线,并将当前终端信息对应的终端状态更新为离线。
由此,推送服务器可以实时获取终端的状态。
在本实施例中,MES系统接收终端的接入请求,根据接入请求接入终端并获取终端信息;然后,根据预设的心跳周期,与终端建立心跳消息交互;根据终端信息和心跳消息交互状态,更新终端的状态。本实施例灵活设置心跳周期,通过MES系统与终端的心跳消息交互,可以及时获取终端用户的在线状态,并进行心跳消息交互异常的处理,实现了对终端用户进行心跳保活,实时获取终端用户的状态。
进一步的,参照图2,本发明终端用户状态获取方法第二实施例提供一种终端用户状态获取方法,基于上述图1所示的实施例,所述步骤S10包括:
步骤S11、接收终端的接入请求,根据所述接入请求获取终端信息。
在终端向MES系统发送登录注册请求,也即接入请求后,MES系统接收终端的接入请求。
具体的,作为一种事实方式,接入服务器接收终端的登录注册请求。终端发送的注册上报请求携带有当前终端的信息。
其中,终端信息可以是终端用户的账户信息,用于标识不同的终端用户,可以根据账户信息唯一的确定当前终端用户。终端信息当然也可以是其他可以标识不同终端用户的信息,可根据实际需要灵活设置。
步骤S12、根据所述终端信息,校验所述终端是否为合法接入。
接入服务器向IPTV系统发起校验请求,由IPTV系统校验当前终端是否为合法接入。其中,接入服务器发送的校验请求携带有当前终端的信 息,用于IPTV系统校验,例如,IPTV系统根据当前终端用户的账号信息,判断当前终端用户是否为合法用户。
IPTV系统完成校验后将校验结果返回给接入服务器。
若当前终端用户为IPTV系统的合法用户,则接入服务器判定当前终端为合法接入;若当前终端用户为IPTV系统的非法用户,则接入服务器判定当前终端为非法接入。
由此,接入服务器得到当前终端是否为合法接入的判定结果。
步骤S13、若所述终端为合法接入,则接入所述终端。
若当前终端为合法接入,则接入服务器允许当前终端的登录注册,接入当前终端。
然后,根据当前推送服务器的负载状况,选择当前负载最轻的推送服务器分配给当前终端。接入服务器将此负载最轻推送服务器的域地址返回给当前终端。
终端根据接入服务器返回的域地址,向推送服务器发起注册上报请求。终端发送的注册上报请求携带有当前终端的信息。
推送服务器接收终端的注册上报请求,获取终端信息,并存储获取的终端信息。
然后,推送服务器根据预设的心跳周期,与当前终端建立心跳消息交互,实时获取当前终端的状态。
若当前终端为非法接入,则接入服务器不通过当前终端的登录注册请求,拒绝当前终端的本次接入请求。
在本实施例中,MES系统接收终端的接入请求,根据接入请求获取终端信息;根据终端信息,校验终端是否为合法接入;若终端为合法接入,则接入终端。本实施例通过对接入终端的校验,保障了MES系统的安全性,避免服务器资源的占用,提高了终端用户实时状态获取的效率。
进一步的,参照图3,本发明终端用户状态获取方法第三实施例提供一种终端用户状态获取方法,基于上述图1或图2所示的实施例(本发明以图2为例),所述步骤S30包括:
步骤S31、根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态。
在终端与推送服务器的心跳消息交互建立后,推送服务器获取终端的心跳消息交互状态。
具体的,作为一种实施方式,根据心跳周期,推送服务器定时向当前终端推送心跳消息。
然后,根据当前终端响应的心跳消息发送状态,获取当前终端的心跳交互状态。
若在心跳周期内,推送服务器正常推送心跳消息,且收到当前终端响应的心跳消息,则当前终端的心跳消息交互状态正常。
若在心跳周期内,推送服务器正常推送心跳消息,但未收到当前终端响应的心跳消息,则当前终端的心跳消息交互状态异常,例如网络延迟、终端被动强制离线等异常情况。推送服务器记录当前终端心跳消息交互发生异常的时间节点。
由此,推送服务器得到当前终端的心跳交互状态。
步骤S32、若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线。
若在心跳周期内,推送服务器正常推送心跳消息,且收到当前终端响应的心跳消息,当前终端的心跳消息交互状态正常。推送服务器根据当前终端的终端信息,将当前终端信息对应的状态设置为在线。
若在当前终端心跳消息交互发生异常的时间节点后、预设的超时时间内,推送服务器再次收到当前终端响应的心跳消息,则判定当前终端的交互状态正常,保持当前终端的状态为在线,过滤因网络阻塞等原因导致的个别心跳周期异常。
步骤S33、若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
若在心跳周期内,推送服务器正常推送心跳消息,但未收到当前终端响应的心跳消息,当前终端的心跳消息交互状态异常,例如终端被迫强制离线。
若在当前终端心跳消息交互发生异常的时间节点起、预设的超时时间后,推送服务器未收到当前终端响应的心跳消息,则推送服务器判定当前终端离线。然后,推送服务器根据当前终端信息,将当前终端信息对应的状态设置为离线。
需要说明的是,预设的超时时间为终端的异常时间,若超过预设的超时时间未收到终端响应的心跳消息,则判定终端异常。预设的超时时间可根据实际需要灵活设置。
由此,推送服务器实时获取到终端的状态。
在本实施例中,MES系统根据心跳周期,向终端推送心跳消息并接收终端响应的心跳消息,获取心跳消息交互状态;若心跳消息交互状态为在心跳周期内,收到终端响应的心跳消息,则根据当前终端信息,设置当前终端的状态为在线;若心跳消息交互状态为在心跳周期内和预设的超时时间内,均未收到终端响应的心跳消息,则根据当前终端信息,设置当前终端的状态为离线,由此MES系统获取终端的状态。本实施例根据终端的心跳消息交互状态对终端进行心跳保活,并根据终端信息实时更新终端的状态,实现了实时获取终端的状态。
进一步的,参照图4,本发明终端用户状态获取方法第四实施例提供一种终端用户状态获取方法,基于上述图3所示的实施例,所述步骤S31之后,还包括:
步骤S34、若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终端的状态为离线。
在终端与推送服务器建立心跳消息交互后,作为一种实施方式,推送服务器向终端推送心跳消息并接收终端响应的心跳消息,获取终端的心跳消息交互状态。
若心跳消息交互状态为终端主动离线,则终端主动向推送服务器发送离线消息。
推送服务器收到终端的离线消息后,根据当前终端的信息,更新当前终端信息对应的终端的状态为离线,结束与当前终端的心跳消息交互。
在本实施例,若心跳消息交互状态为MES系统收到终端的离线消息,则设置终端的状态为离线。本实施例在终端主动离线后,实时更新终端的状态,实现了终端实时状态的获取。
进一步的,参照图5,本发明终端用户状态获取方法第五实施例提供一种终端用户状态获取方法,基于上述图4所示的实施例,所述步骤S31之后,还包括:
步骤S35、若所述心跳消息交互状态为向所述终端推送心跳消息异常,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息,并转入执行步骤S20。
在MES系统服务发生异常导致心跳消息交互状态异常时,例如推送服务器向终端推送心跳消息异常,无法向终端成功推送心跳消息,具体的,作为一种实施方式,若在预设的异常时间内,MES系统服务恢复正常,能够成功向终端推送心跳消息,则推送服务器在心跳消息的推送恢复正常后,向终端发送接入消息,例如,接入消息包括字段Result=1(Result=0,意为心跳消息交互成功;Result=1,意为终端申请重新接入),使终端重新接入推送服务器。
终端收到推送服务器的接入消息后,向推送服务器发起注册接入请求。 推送服务器根据预设的心跳周期,与终端建立心跳消息交互。
若在预设的异常时间内,MES系统服务未恢复正常,则终端向MES系统接入服务器发送登录注册请求,也即接入请求,重新获取MES系统服务。
需要说明的是,预设的异常时间为MES系统服务的异常时间,若MES系统服务的异常时间超过预设的异常时间,则判定MES系统服务异常。预设的异常时间可根据实际需要灵活设置。
在本实施例中,若心跳消息交互状态为MES系统向终端推送心跳消息异常,且在预设的异常时间内,MES系统成功恢复向终端心跳消息的推送,则向终端发送心跳接入消息,根据预设的心跳周期,重新与终端建立心跳消息交互,避免终端再次重复接入MES系统,实现了终端用户实时状态获取过程中,短暂异常情况的处理,提高了终端用户实时状态获取的处理效率。
参照图6,本发明终端用户状态获取装置第一实施例提供一种终端用户状态获取装置,所述终端用户状态获取装置包括:
接入模块100,设置为接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端。
本发明实施例通过终端用户状态获取装置获取终端用户的实时状态,终端用户状态获取装置位于MES系统(Message Exange System,信息交互系统),主要应用于交互式网络电视IPTV终端用户实时状态的更新或统计,当然也可以用于其他用户实时状态的更新或统计,可根据实际需要灵活应用。IPTV终端可以是STB(Set-Top-Box,机顶盒)、PC(personal computer,个人计算机)、Pad、手机等。
具体的,作为一种实施方式,接入模块100预先在IPTV系统配置域地址Domain,Domain为当前终端接入接入模块100的地址和端口。
IPTV终端用户在启动后,向IPTV系统发起登录请求。IPTV系统校 验终端用户的账号,若当前终端用户为合法用户,则允许当前终端用户成功登录。然后,IPTV系统向当前终端下发Domain。
终端用户成功登录IPTV系统后,终端获取IPTV系统下发的Domain,并根据Domain向接入模块100发起登录注册请求。
接入模块100接收终端的登录注册请求,也即接入请求,获取终端信息。
其中,终端发送的注册上报请求携带有当前终端的信息。其中,终端信息可以是终端用户的账户信息,用于标识不同的终端用户,可以根据账户信息唯一的确定当前终端用户。终端信息当然也可以是其他可以标识不同终端用户的信息,可根据实际需要灵活设置。
接入模块100通过当前终端的接入请求,接入终端,并给当前终端分配心跳模块200。为保证负载均衡,接入模块100根据当前心跳模块200的负载状况,选择当前负载最轻的心跳模块200分配给当前终端。接入模块100将此负载最轻心跳模块200的域地址返回给当前终端。
心跳模块200,设置为根据预设的心跳周期,与所述终端建立心跳消息交互。
在接收终端的接入请求,并获取终端信息后,心跳模块200与终端建立心跳消息交互。
具体的,作为一种实施方式,终端根据接入服务器返回的域地址,向心跳模块200发起注册上报请求。终端发送的注册上报请求携带有当前终端的信息。
心跳模块200接收终端的注册上报请求,对终端进行注册,获取并存储终端信息。
注册成功后,心跳模块200根据预设的心跳周期,开始与终端进行心跳消息交互。
其中,心跳模块200与终端建立的心跳可以是HTTP协议心跳,也可以是UDP协议心跳,可根据终端的实际情况灵活设置,例如:PC终端采 用HTTP协议心跳,则心跳模块200与PC终端建立HTTP链路;STB、Pad和手机采用UDP协议心跳,则心跳模块200与STB、Pad或手机建立UDP链路。
在终端与心跳模块200的心跳消息交互建立后,根据预设的心跳周期,心跳模块200定时向终端推送心跳消息。终端在收到心跳模块200推送的心跳消息后,在预设的心跳周期内,向心跳模块200发送心跳消息,进行心跳消息交互。
需要说明的是,预设的心跳周期指预设的时间内,心跳模块200与终端预设的心跳消息交互次数,为可调配的,例如:设置心跳周期为1分钟1次,则每隔1分钟,心跳模块200与终端进行一次心跳消息的交互。
其中,心跳消息为预设规范的消息格式,可预先配置心跳消息的字段格式,并进行灵活设置。
状态模块300,设置为根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
在心跳模块200与终端建立心跳消息交互后,状态模块300根据终端信息和实时的心跳消息交互状态,实时更新终端的状态。
具体的,作为一种实施方式,状态模块300根据心跳消息交互状态,设置或更新终端信息对应的终端状态。
若在心跳周期内,心跳模块200与终端成功进行心跳消息交互,则状态模块300判定当前终端用户在线,并将当前终端信息对应的终端状态设置为在线。
若在心跳周期内,心跳模块200与终端未成功进行心跳消息交互,则状态模块300认为当前心跳消息交互异常。若心跳模块200的心跳消息推送正常,在预设的超时时间内,若心跳模块200仍然未能与终端成功进行心跳消息交互,则状态模块300判定当前终端用户离线,并将当前终端信息对应的终端状态更新为离线。
由此,状态模块300可以实时获取终端的状态。
在本实施例中,接入模块100接收终端的接入请求,根据接入请求接入终端并获取终端信息;然后,心跳模块200根据预设的心跳周期,与终端建立心跳消息交互;状态模块300根据终端信息和心跳消息交互状态,更新终端的状态。本实施例灵活设置心跳周期,通过终端用户状态获取装置与终端的心跳消息交互,可以及时获取终端用户的在线状态,并进行心跳消息交互异常的处理,实现了对终端用户进行心跳保活,实时获取终端用户的状态。
进一步的,参照图7,本发明终端用户状态获取装置第二实施例提供一种终端用户状态获取装置,基于上述图6所示的实施例,所述接入模块100包括:
接收单元110,设置为接收终端的接入请求,根据所述接入请求获取终端信息。
在终端向MES系统发送登录注册请求,也即接入请求后,接收单元110接收终端的接入请求。
具体的,作为一种事实方式,接收单元110接收终端的登录注册请求。终端发送的注册上报请求携带有当前终端的信息。
其中,终端信息可以是终端用户的账户信息,用于标识不同的终端用户,可以根据账户信息唯一的确定当前终端用户。终端信息当然也可以是其他可以标识不同终端用户的信息,可根据实际需要灵活设置。
校验单元120,设置为根据所述终端信息,校验所述终端是否为合法接入。
校验单元120向IPTV系统发起校验请求,由IPTV系统校验当前终端是否为合法接入。其中,校验单元120发送的校验请求携带有当前终端的信息,用于IPTV系统校验,例如,IPTV系统根据当前终端用户的账号信息,判断当前终端用户是否为合法用户。
IPTV系统完成校验后将校验结果返回给校验单元120。
若当前终端用户为IPTV系统的合法用户,则校验单元120判定当前终端为合法接入;若当前终端用户为IPTV系统的非法用户,则校验单元120判定当前终端为非法接入。
由此,校验单元120得到当前终端是否为合法接入的判定结果。
接入单元130,设置为若所述终端为合法接入,则接入所述终端。
若当前终端为合法接入,则接入单元130允许当前终端的登录注册,介入当前终端。
然后,接入单元130根据当前心跳模块200的负载状况,选择当前负载最轻的心跳模块200分配给当前终端。接入单元130将此负载最轻心跳模块200的域地址返回给当前终端。
终端根据接入单元130返回的域地址,向心跳模块200发起注册上报请求。终端发送的注册上报请求携带有当前终端的信息。
心跳模块200接收终端的注册上报请求,获取终端信息,并存储获取的终端信息。
然后,心跳模块200根据预设的心跳周期,与当前终端建立心跳消息交互,实时获取当前终端的状态。
若当前终端为非法接入,则接入单元130不通过当前终端的登录注册请求,拒绝当前终端的本次接入请求。
在本实施例中,接收单元110接收终端的接入请求,根据接入请求获取终端信息;检验单元120根据终端信息,校验终端是否为合法接入;若终端为合法接入,则接入单元130接入终端。本实施例通过对接入终端的校验,保障了终端用户实时状态获取装置的安全性,避免服务器资源的占用,提高了终端用户实时状态获取的效率。
进一步的,参照图8,本发明终端用户状态获取装置第三实施例提供 一种终端用户状态获取装置,基于上述图6或图7所示的实施例(本实施例以图7为例),所述状态模块300包括:
交互单元310,设置为根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态。
在终端与心跳模块200的心跳消息交互建立后,状态模块300获取终端的心跳交互状态。
具体的,作为一种实施方式,根据心跳周期,交互单元310定时向当前终端推送心跳消息。
然后,根据当前终端响应的心跳消息发送状态,获取当前终端的心跳交互消息状态。
若在心跳周期内,交互单元310正常推送心跳消息,且收到当前终端响应的心跳消息,则当前终端的心跳消息交互状态正常。
若在心跳周期内,交互单元310正常推送心跳消息,但未收到当前终端响应的心跳消息,则当前终端的心跳消息交互状态异常,例如网络延迟、终端被动强制离线等异常情况。交互单元310记录当前终端心跳消息交互发生异常的时间节点。
由此,交互单元310得到当前终端的心跳交互状态。
设置单元320,设置为若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线;若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
若在心跳周期内,交互单元310正常推送心跳消息,且收到当前终端响应的心跳消息,当前终端的心跳消息交互状态正常。设置单元320根据当前终端的终端信息,将当前终端信息对应的状态设置为在线。
若在当前终端心跳消息交互发生异常的时间节点后、预设的超时时间内,交互单元310再次收到当前终端响应的心跳消息,则判定当前终端的 交互状态正常,设置单元320保持当前终端的状态为在线,过滤因网络阻塞等原因导致的个别心跳周期异常。
若在心跳周期内,交互单元310正常推送心跳消息,但未收到当前终端响应的心跳消息,当前终端的心跳消息交互状态异常,例如终端被迫强制离线。
若在当前终端心跳消息交互发生异常的时间节点起、预设的超时时间后,交互单元310未收到当前终端响应的心跳消息,则判定当前终端离线。然后,设置单元320根据当前终端信息,将当前终端信息对应的状态设置为离线。
需要说明的是,预设的超时时间为终端的异常时间,若超过预设的超时时间未收到终端响应的心跳消息,则判定终端异常。预设的超时时间可根据实际需要灵活设置。
由此,设置单元320实时获取到终端的状态。
在本实施例中,交互单元310根据心跳周期,向终端推送心跳消息并接收终端响应的心跳消息,获取心跳消息交互状态;若心跳消息交互状态为在心跳周期内,收到终端响应的心跳消息,则设置单元320根据当前终端信息,设置当前终端的状态为在线;若心跳消息交互状态为在心跳周期内和预设的超时时间内,均未收到终端响应的心跳消息,则设置单元320根据当前终端信息,设置当前终端的状态为离线,由此MES系统获取终端的状态。本实施例终端用户实时状态获取装置根据终端的心跳消息交互状态对终端进行心跳保活,并根据终端信息实时更新终端的状态,实现了实时获取终端的状态。
进一步的,参照图8,本发明终端用户状态获取装置第四实施例提供一种终端用户状态获取装置,基于上述图8所示的本发明终端用户状态获取装置第三实施例,所述设置单元320还设置为,
若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终 端的状态为离线。
在终端与心跳模块200建立心跳消息交互后,作为一种实施方式,交互单元310向终端推送心跳消息并接收终端响应的心跳消息,获取终端的心跳消息交互状态。
若心跳消息交互状态为终端主动离线,则终端主动向交互单元310发送离线消息。
交互单元310收到终端的离线消息后,设置单元320根据当前终端的信息,更新当前终端信息对应的终端的状态为离线,结束与当前终端的心跳消息交互。
在本实施例,若心跳消息交互状态为交互单元310收到终端的离线消息,则设置单元320设置终端的状态为离线。本实施例在终端主动离线后,终端用户实时状态获取装置实时更新终端的状态,实现了终端实时状态的获取。
进一步的,参照图9,本发明终端用户状态获取装置第五实施例提供一种终端用户状态获取装置,基于上述图8所示的本发明终端用户状态获取装置第四实施例,所述状态模块300还包括:
异常单元330,设置为若所述心跳消息交互状态为向所述终端推送心跳消息异常时,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息。
在交互单元310发生异常导致心跳消息交互状态异常时,例如交互单元310向终端推送心跳消息异常,无法向终端成功推送心跳消息,具体的,作为一种实施方式,若在预设的异常时间内,交互单元310服务恢复正常,能够成功向终端推送心跳消息,则在心跳消息的推送恢复正常后,异常单元330向终端发送接入消息,例如,接入消息包括字段Result=1(Result=0,意为心跳消息交互成功;Result=1,意为终端申请重新接入),使终端重新接入心跳模块200。
终端收到异常单元330的接入消息后,向心跳模块200发起注册接入请求。心跳模块200根据预设的心跳周期,与终端建立心跳消息交互。
若在预设的异常时间内,交互单元310服务未恢复正常,则终端向接入模块100发送登录注册请求,也即接入请求,重新获取服务。
需要说明的是,预设的异常时间为交互单元310的异常时间,若交互单元310的异常时间超过预设的异常时间,则判定交互单元310服务异常。预设的异常时间可根据实际需要灵活设置。
在本实施例中,若心跳消息交互状态为交互单元310向终端推送心跳消息异常,若在预设的异常时间内,交互单元310成功恢复向终端心跳消息的推送,则异常单元330向终端发送心跳接入消息,心跳模块200根据预设的心跳周期,重新与终端建立心跳消息交互,避免终端再次重复接入接入模块100,实现了终端用户实时状态获取过程中,短暂异常情况的处理,提高了终端用户实时状态获取的处理效率。
参照图10,本发明终端用户状态获取系统提供一种终端用户状态获取系统,所述终端用户状态获取系统包括消息交互系统MES系统A、终端B和交互式网络电视IPTV系统C,其中:
所述MES系统A,包括接入服务器A1和推送服务器A2;
所述接入服务器A1,设置为接收终端B的接入请求,根据所述接入请求获取终端信息;根据所述终端信息,校验所述终端B是否为合法接入;若所述终端B为合法接入,则接入所述终端B;
所述推送服务器A2,设置为根据预设的心跳周期,与所述终端B建立心跳消息交互;根据所述终端B信息和所述心跳消息交互状态,获取所述终端B的状态。
本发明实施例通过MES系统A(Message Exange System,信息交互系统)获取IPTV终端B用户实时状态。终端B登录IPTV系统C时,主动向MES系统A注册接入,接入成功后通过心跳消息保活,终端B退出 登录时主动向MES系统A发离线消息,MES系统A将终端B状态置为离线。
具体的,作为一种实施方式,MES系统A包括接入服务器A1和推送服务器A2。
参照图11,以IPTV终端用户状态的获取进行举例说明。
接入服务器A1,可以包括主接入服务器和备用接入服务器,接收终端B的接入请求,并获取终端B的信息。
然后,接入服务器A1根据终端B的信息,向IPTV系统C发送校验请求。
IPTV系统C根据终端B的信息,校验终端B是否为合法用户,并将校验结果返回给接入服务器A1。
若终端B为非法用户,则终端B为非法接入,接入服务器A1拒绝终端B的接入请求。
若终端B为合法用户,则终端B为合法接入,接入服务器A1,响应终端B的接入请求,通过终端B的接入请求,接入终端B。
接入服务器A1推送服务器A2进行负载均衡,根据当前推送服务器A2的负载状况,选择当前负载最轻的推送服务器分配给终端B,用于与终端B建立心跳消息交互。接入服务器A1将分配的推送服务器A2的域地址Domain返回给终端B。
终端B根据收到的推送服务器A2的域地址Domain,向推送服务器A2发送注册上报请求。
推送服务器A2接收终端B的注册上报请求后,根据终端B的注册上报请求,与终端B建立心跳消息交互,响应终端B的注册上报请求。推送服务器A2根据预设的心跳周期,与终端B保持心跳消息交互。
推送服务器A2根据终端B的信息和心跳消息交互状态,获取终端B的状态。例如,推送服务器A2向终端B发送心跳消息,在心跳周期内,收到终端B响应的心跳消息,则根据终端B的信息设置终端B的状态为在线;若在心跳周期内和预设的超时时间内,均未收到终端B响应的心跳 消息,则根据终端B的信息,更新终端B的状态为离线。
同时,若推送服务器A2出现短暂的异常,异常时间在预设的异常时间范围内,则推送服务器A2在恢复服务后,向终端B发送心跳接入消息,与终端B建立心跳消息交互,进行心跳消息保活。
接入服务器A1还设置为接收第三方平台发来的待推送的消息,由推送服务器A2将消息推送给终端B。
所述终端B,设置为向所述MES系统A发起接入请求,与所述MES系统A建立心跳消息交互。
在本发明应用于IPTV系统C的终端用户状态获取时,终端B包括STB(Set-Top-Box,机顶盒)、PC(personal computer,个人计算机)、Pad、手机等能够接入IPTV系统C的终端。
终端B在开机启动后,向IPTV系统C发起登录请求,登录成功后,获取IPTV系统C返回的MES系统A的域地址Domain。
然后,终端B根据Domain向MES系统A发送登录注册请求,也即接入请求,请求接入MES系统A。终端B发送的接入请求携带有终端B的信息。
在终端B的接入请求通过后,根据MES系统A返回的域地址,向MES系统A发送注册上报请求。终端B发送的注册上报请求携带有终端B的信息。
MES系统A与终端B的建立心跳消息交互后,终端B按照预设的心跳周期,向MES系统A发送心跳消息,保持与MES系统A的心跳消息交互,进行心跳消息保活。
若终端B超过预设的响应时间,未收到MES系统A的心跳消息,则向接入服务器A1发出重新接入请求,由接入服务器A1重新分配的推送服务器A2,与终端B建立心跳消息互动。其中,预设的响应时间可根据实际需要灵活设置。
所述IPTV系统C,设置为向所述MES系统A提供所述终端B是否合法接入的校验服务。
IPTV系统C通过门户系统EPG(Electronic Program Guide,电子节目指南),与终端B和MES系统A进行交互。
在终端B向IPTV系统C发起登录请求后,IPTV系统C根据数据库中的用户登记表,判断终端B是否为合法用户。
若终端B为非法用户,则禁止终端B登录IPTV系统C。
若终端B为合法用户,则允许终端B登录IPTV系统C,然后,向终端B返回MES系统A的域地址Domain。其中,Domain为预先配置的MES系统A的接入服务器A1的地址和端口。
在终端B向MES系统A发起接入请求后,MES系统A获取终端B的信息,并向IPTV系统C发起校验请求。
IPTV系统C根据MES系统A的校验请求,校验终端B是否为合法用户,并将校验结果返回给MES系统A。
在本实施例中,终端用户状态获取系统包括消息交互系统MES系统A、终端B和交互式网络电视IPTV系统C;终端B登陆IPTV系统C后,主动向MES系统A注册接入,接入成功后通过心跳消息保活;MES系统A根据心跳消息交互状态和终端B的信息,获取终端B的状态;终端B退出登陆时主动向MES系统A发离线消息,MES系统A将终端状态置为离线。本实施例中实现了MES系统与终端用户的心跳保活,能够获取终端用户的实时状态。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,接收终端的接入请求,根据接入请求获取终端信息并接入终端;
S2,根据预设的心跳周期,与终端建立心跳消息交互;
S3,根据终端信息和心跳消息交互状态,获取终端的状态。
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:
S1,接收终端的接入请求,根据接入请求获取终端信息;
S2,根据终端信息,校验终端是否为合法接入;
S3,若终端为合法接入,则接入终端。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
工业实用性
在本发明实施例中,通过MES系统接收终端的接入请求,根据接入请求获取终端信息并接入终端;然后,根据预设的心跳周期,与终端建立心跳消息交互;根据终端信息和心跳消息交互状态,更新终端的状态。本发明灵活设置心跳周期,通过MES系统与终端的心跳消息交互,可以及时获取终端用户的在线状态,并进行心跳消息交互异常的处理,实现了对终端用户进行心跳保活,实时获取终端用户的状态。

Claims (11)

  1. 一种终端用户状态获取方法,所述终端用户状态获取方法包括以下步骤:
    接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;
    根据预设的心跳周期,与所述终端建立心跳消息交互;
    根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
  2. 如权利要求1所述的终端用户状态获取方法,其中,所述接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端的步骤包括:
    接收终端的接入请求,根据所述接入请求获取终端信息;
    根据所述终端信息,校验所述终端是否为合法接入;
    若所述终端为合法接入,则接入所述终端。
  3. 如权利要求1或2所述的终端用户状态获取方法,其中,所述根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态的步骤包括:
    根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态;
    若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线;
    若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
  4. 如权利要求3所述的终端用户状态获取方法,其中,所述根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态的步骤之后,还包括:
    若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终端的状态为离线。
  5. 如权利要求4所述的终端用户状态获取方法,其中,所述根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态的步骤之后,还包括:
    若所述心跳消息交互状态为向所述终端推送心跳消息异常,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息,并转入执行步骤:根据预设的心跳周期,与所述终端建立心跳消息交互。
  6. 一种终端用户状态获取装置,所述终端用户状态获取装置包括:
    接入模块,设置为接收终端的接入请求,根据所述接入请求获取终端信息并接入所述终端;
    心跳模块,设置为根据预设的心跳周期,与所述终端建立心跳消息交互;
    状态模块,设置为根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态。
  7. 如权利要求6所述的终端用户状态获取装置,其中,所述接入模块包括:
    接收单元,设置为接收终端的接入请求,根据所述接入请求获取终端信息;
    校验单元,设置为根据所述终端信息,校验所述终端是否为合法接入;
    接入单元,设置为若所述终端为合法接入,则接入所述终端。
  8. 如权利要求6或7所述的终端用户状态获取装置,其中,所述状态模块包括:
    交互单元,设置为根据所述心跳周期,向所述终端推送心跳消息并接收所述终端响应的心跳消息,获取所述心跳消息交互状态;
    设置单元,设置为若所述心跳消息交互状态为在所述心跳周期内,收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为在线;若所述心跳消息交互状态为在所述心跳周期内和预设的超时时间内,均未收到所述终端响应的心跳消息,则根据所述终端信息,设置所述终端的状态为离线。
  9. 如权利要求8所述的终端用户状态获取装置,其中,所述设置单元还设置为,
    若所述心跳消息交互状态为收到所述终端的离线消息,则设置所述终端的状态为离线。
  10. 如权利要求9所述的终端用户状态获取装置,其中,所述状态模块还包括:
    异常单元,设置为若所述心跳消息交互状态为向所述终端推送心跳消息异常,且在预设的异常时间内,成功恢复向所述终端心跳消息的推送,则向所述终端发送心跳接入消息。
  11. 一种终端用户状态获取系统,所述终端用户状态获取系统包括消息交互系统MES系统、终端和交互式网络电视IPTV系统,其中:
    所述MES系统,包括接入服务器和推送服务器;
    所述接入服务器,设置为接收终端的接入请求,根据所述接入请求获取终端信息;根据所述终端信息,校验所述终端是否为合法接入;若所述终端为合法接入,则接入所述终端;
    所述推送服务器,设置为根据预设的心跳周期,与所述终端建立心跳消息交互;根据所述终端信息和所述心跳消息交互状态,获取所述终端的状态;
    所述终端,设置为向所述MES系统发起接入请求,与所述MES系统建立心跳消息交互;
    所述IPTV系统,设置为向所述MES系统提供所述终端是否合法接入的校验服务。
PCT/CN2016/100403 2015-11-11 2016-09-27 终端用户状态获取方法、装置和系统 WO2017080328A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510765983.2 2015-11-11
CN201510765983.2A CN106686576A (zh) 2015-11-11 2015-11-11 终端用户状态获取方法、装置和系统

Publications (1)

Publication Number Publication Date
WO2017080328A1 true WO2017080328A1 (zh) 2017-05-18

Family

ID=58694738

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/100403 WO2017080328A1 (zh) 2015-11-11 2016-09-27 终端用户状态获取方法、装置和系统

Country Status (2)

Country Link
CN (1) CN106686576A (zh)
WO (1) WO2017080328A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472881A (zh) * 2021-06-30 2021-10-01 四川虹美智能科技有限公司 在线终端设备的统计方法和装置

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107835453A (zh) * 2017-08-31 2018-03-23 江苏省公用信息有限公司 一种基于网页向电视iptv内容甩屏的方法
CN107750010A (zh) * 2017-09-28 2018-03-02 深圳市九洲电器有限公司 多屏互动操控同步响应方法及系统
CN108307416B (zh) * 2018-01-31 2021-09-21 成都物梦工场信息技术有限公司 一种物联网终端管理方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008118638A1 (en) * 2007-03-26 2008-10-02 Telespree Communications Method and apparatus for secure immediate wireless access in a telecommunications network
CN102036122A (zh) * 2010-11-29 2011-04-27 华为终端有限公司 向iptv终端推送电子邮件信息的方法、装置和系统
CN102263988A (zh) * 2010-05-25 2011-11-30 中兴通讯股份有限公司 交互式网络电视iptv的消息业务的实现方法及系统
CN102523485A (zh) * 2011-12-19 2012-06-27 深圳市同洲视讯传媒有限公司 一种消息分发方法和系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110170452A1 (en) * 2007-12-07 2011-07-14 Scl Elements Inc. Auto-Configuring Multi-Layer Network
CN101217512B (zh) * 2008-01-11 2010-08-18 腾讯科技(深圳)有限公司 客户端状态维护方法、系统及应用服务器
CN102185837A (zh) * 2011-04-20 2011-09-14 北京鸿天伟业安全技术有限公司 智能多媒体信息发布系统
CN103096435B (zh) * 2011-10-31 2015-10-07 中国移动通信集团公司 连接保持方法、装置以及移动终端

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008118638A1 (en) * 2007-03-26 2008-10-02 Telespree Communications Method and apparatus for secure immediate wireless access in a telecommunications network
CN102263988A (zh) * 2010-05-25 2011-11-30 中兴通讯股份有限公司 交互式网络电视iptv的消息业务的实现方法及系统
CN102036122A (zh) * 2010-11-29 2011-04-27 华为终端有限公司 向iptv终端推送电子邮件信息的方法、装置和系统
CN102523485A (zh) * 2011-12-19 2012-06-27 深圳市同洲视讯传媒有限公司 一种消息分发方法和系统

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472881A (zh) * 2021-06-30 2021-10-01 四川虹美智能科技有限公司 在线终端设备的统计方法和装置
CN113472881B (zh) * 2021-06-30 2023-08-15 四川虹美智能科技有限公司 在线终端设备的统计方法和装置

Also Published As

Publication number Publication date
CN106686576A (zh) 2017-05-17

Similar Documents

Publication Publication Date Title
EP3013086B1 (en) Method, apparatus and electronic device for connection management
CN109005204B (zh) 一种直播处理方法、装置及系统
US9578040B2 (en) Packet receiving method, deep packet inspection device and system
CN101605108B (zh) 一种即时通信的方法、系统及装置
CN110213522B (zh) 一种视频数据处理方法、装置以及相关设备
US9374372B2 (en) Systems and methods for profiling client devices
US10148650B2 (en) Method, device and system for user authentication
WO2017080328A1 (zh) 终端用户状态获取方法、装置和系统
WO2017096846A1 (zh) 一种直播视频的获取方法、装置及系统
CN102739684B (zh) 一种基于虚拟IP地址的Portal认证方法及服务器
US11297158B1 (en) Proxy selection by monitoring quality and available capacity
US20140325628A1 (en) Login method, apparatus, and system
CN106209727B (zh) 一种会话访问方法和装置
WO2016119420A1 (zh) 一种对网络资源的恶意访问检测方法、装置及通信网关
CN105722072A (zh) 一种业务授权方法、装置、系统及路由器
CN107294910B (zh) 一种登录方法和服务器
CN111092904B (zh) 网络连接方法和装置
WO2015096802A1 (zh) 消息发送方法、装置及服务器
CN109525620B (zh) 一种消息推送系统、方法及装置
CN108886533B (zh) 加速与主机服务器的连接
US20150149629A1 (en) User online state querying method and apparatus
WO2019071857A1 (zh) 一种直播平台中防止刷礼物的方法及装置
CN109819278B (zh) 直播视频的优化方法
KR101236500B1 (ko) 소형 임베디드 장치를 위한 sns 중계 서비스 장치 및 그 방법
CN104702612A (zh) 一种用户认证处理方法及装置

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: 16863505

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: 16863505

Country of ref document: EP

Kind code of ref document: A1