[go: up one dir, main page]

CN106612307A - Always-on service implementation method and device - Google Patents

Always-on service implementation method and device Download PDF

Info

Publication number
CN106612307A
CN106612307A CN201510695847.0A CN201510695847A CN106612307A CN 106612307 A CN106612307 A CN 106612307A CN 201510695847 A CN201510695847 A CN 201510695847A CN 106612307 A CN106612307 A CN 106612307A
Authority
CN
China
Prior art keywords
aoe
message
session
long connection
registration request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510695847.0A
Other languages
Chinese (zh)
Other versions
CN106612307B (en
Inventor
乔春雷
陈阁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201510695847.0A priority Critical patent/CN106612307B/en
Publication of CN106612307A publication Critical patent/CN106612307A/en
Application granted granted Critical
Publication of CN106612307B publication Critical patent/CN106612307B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • 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
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • 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/141Setup of application sessions
    • 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/55Push-based network services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明实施例公开了一种永远在线业务的实现方法,所述方法包括:部署在防火墙之外的CS的至少一次向部署在防火墙之内的PS发送CS注册请求消息,CS对应接收至少一次所述PS返回的CS注册应答消息,建立与所述PS之间的至少一个第一长连接;接收AOE发送的AOE注册请求消息,从所述至少一个第一长连接中选择一个第一长连接为AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息;通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息,将所述AOE注册应答消息中的PS Session ID删除后转发给所述AOE。本发明实施例还公开了一种永远在线业务的实现装置。

The embodiment of the present invention discloses a method for realizing an always-on service. The method includes: at least once, the CS deployed outside the firewall sends a CS registration request message to the PS deployed inside the firewall, and the CS correspondingly receives the at least once The CS registration response message returned by the PS, establish at least one first long connection with the PS; receive the AOE registration request message sent by the AOE, and select a first long connection from the at least one first long connection as The first long connection of the AOE, and forward the AOE registration request message to the PS through the first long connection of the AOE; receive the AOE registration response message returned by the PS through the first long connection of the AOE, and send The PS Session ID in the AOE registration response message is deleted and forwarded to the AOE. The embodiment of the invention also discloses a device for realizing the always-on service.

Description

一种永远在线业务的实现方法及装置Method and device for realizing always-on service

技术领域technical field

本发明涉及数据业务领域,尤其涉及一种永远在线业务的实现方法及装置。The invention relates to the field of data services, in particular to a method and device for realizing an always-on service.

背景技术Background technique

永远在线(Always On/IP Push)技术是一种服务器主动将信息发往客户端的技术,目前在移动通信领域中应用十分广泛。通过永远在线技术,服务器可以将重要的信息主动及时地推送到用户终端上,使得用户终端能够随时随地接收信息,为用户提供了极大的方便。The always-on (Always On/IP Push) technology is a technology in which a server actively sends information to a client, and is currently widely used in the field of mobile communications. Through the always-on technology, the server can actively and timely push important information to the user terminal, so that the user terminal can receive information anytime and anywhere, which provides great convenience for the user.

永远在线技术是一种基于传输控制协议/因特网互联协议(TCP/IP,Transmission Control Protocol/Internet Protocol)的长连接技术,用户终端包含一个与业务相关的客户端,客户端需要与服务器保持一个TCP长连接,连接有效时服务器可以向客户端推送信息。Always-on technology is a long connection technology based on Transmission Control Protocol/Internet Protocol (TCP/IP, Transmission Control Protocol/Internet Protocol). The user terminal includes a business-related client, and the client needs to maintain a TCP connection with the server. Long connection, the server can push information to the client when the connection is valid.

为方便描述,永远在线技术中的客户端定义为永远在线引擎(AOE,Always-On Engine),服务器端则定义为永远在线网关(AOG,Always-OnGateway),AOE运行在用户终端,维持与AOG网关的TCP长连接,并接收AOG网关推送的消息。AOG维持与用户终端AOE的TCP长连接,并在需要时将重要消息推送到用户终端的AOE。For the convenience of description, the client side in the always-on technology is defined as the always-on engine (AOE, Always-On Engine), and the server side is defined as the always-on gateway (AOG, Always-OnGateway). The gateway's TCP long connection, and receive the message pushed by the AOG gateway. AOG maintains a long TCP connection with the user terminal AOE, and pushes important messages to the user terminal AOE when needed.

AOG需要保存用户终端的相关数据,如用户终端的标识、离线消息等。为了保证用户终端数据的安全性,避免潜在的网络攻击,保证AOG系统的稳定性,AOG及其数据库需要部署在防火墙设备之内。用户终端的AOE与AOG的TCP长连接需要通过防火墙设备。The AOG needs to save relevant data of the user terminal, such as the identifier of the user terminal, offline messages, and the like. In order to ensure the security of user terminal data, avoid potential network attacks, and ensure the stability of the AOG system, AOG and its database need to be deployed within the firewall device. The TCP persistent connection between AOE and AOG of the user terminal needs to pass through the firewall device.

如图1所示,用户终端的AOE通过防火墙与AOG保持TCP长连接,每个在线用户终端(如终端A和终端B)独占防火墙设备的一个TCP长连接,随着在线用户终端数量的持续增长,通过防火墙的并发连接数会持续增加,防火墙压力大。由于防火墙设备支持的并发连接数量是有限制的,为支持更多在线用户,需要部署更高端的防火墙设备,极大增加了运营成本。As shown in Figure 1, the AOE of the user terminal maintains a TCP persistent connection with the AOG through the firewall, and each online user terminal (such as terminal A and terminal B) exclusively occupies a TCP persistent connection of the firewall device. As the number of online user terminals continues to grow , the number of concurrent connections passing through the firewall will continue to increase, and the pressure on the firewall will be high. Since the number of concurrent connections supported by firewall devices is limited, in order to support more online users, higher-end firewall devices need to be deployed, which greatly increases operating costs.

发明内容Contents of the invention

有鉴于此,本发明实施例期望提供一种永远在线业务的实现方法及装置,可以降低防火墙压力,进而降低系统运营成本。In view of this, the embodiments of the present invention expect to provide a method and device for implementing an always-on service, which can reduce the pressure on the firewall and further reduce the operating cost of the system.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:

一种永远在线业务的实现方法,所述方法应用于部署在防火墙之外的连接服务器CS,包括:A method for implementing an always-on service, the method being applied to a connection server CS deployed outside a firewall, comprising:

至少一次向部署在防火墙之内的推送业务服务器PS发送CS注册请求消息,所述CS注册请求消息中包括所述CS的IP地址,所述CS的IP地址用于使所述CS注册请求消息通过防火墙至所述PS;Sending a CS registration request message to the push service server PS deployed in the firewall at least once, the CS registration request message includes the IP address of the CS, and the IP address of the CS is used to make the CS registration request message pass through Firewall to said PS;

对应接收至少一次所述PS返回的CS注册应答消息,建立与所述PS之间的至少一个第一长连接;Corresponding to receiving at least one CS registration response message returned by the PS, establishing at least one first long connection with the PS;

接收永远在线引擎AOE发送的AOE注册请求消息,根据所述AOE注册请求消息为所述AOE创建对应的CS会话Session,记录所述CS Session对应的CS Session ID;Receive the AOE registration request message sent by the always-on engine AOE, create a corresponding CS session session for the AOE according to the AOE registration request message, and record the CS Session ID corresponding to the CS Session;

从所述至少一个第一长连接中选择一个第一长连接为所述AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息;Selecting a first persistent connection from the at least one first persistent connection as the first persistent connection of the AOE, and forwarding the AOE registration request message to the PS through the first persistent connection of the AOE;

通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息,所述AOE注册应答消息中携带有所述PS为所述AOE创建的PS Session的PSSession ID;receiving the AOE registration response message returned by the PS through the first long connection of the AOE, the AOE registration response message carrying the PSSession ID of the PS Session created by the PS for the AOE;

所述CS保存所述PS Session ID,并将所述AOE注册应答消息中的PSSession ID删除后转发给所述AOE;The CS saves the PS Session ID, deletes the PSSession ID in the AOE registration response message and forwards it to the AOE;

接收所述AOE发送的AOE消息,在所述AOE消息上增加一个CS-PS消息头后通过所述AOE的第一长连接转发给所述PS,所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;receiving the AOE message sent by the AOE, adding a CS-PS message header to the AOE message and forwarding it to the PS through the first long connection of the AOE, and the CS-PS message header includes the AOE identifier, PS Session ID and CS Session ID;

通过所述AOE的第一长连接接收所述PS返回的PS消息,删除所述PS消息中的CS-PS消息头后转发给所述AOE。Receive the PS message returned by the PS through the first long connection of the AOE, delete the CS-PS message header in the PS message, and forward it to the AOE.

上述方案中,在建立与所述PS之间的至少一个第一长连接后,所述方法还包括:In the above solution, after establishing at least one first long connection with the PS, the method further includes:

通过任意一个第一长连接定时向所述PS发送CS负载信息。Sending the CS load information to the PS at regular intervals through any one of the first long connections.

一种永远在线业务的实现方法,所述方法应用于部署在防火墙之外的推送业务服务器PS,包括:A method for realizing an always-on service, the method being applied to a push service server PS deployed outside a firewall, comprising:

接收部署在防火墙之外的连接服务器CS发送的CS注册请求消息,并向所述CS返回CS注册应答消息,建立与所述CS之间的第一长连接;receiving a CS registration request message sent by a connection server CS deployed outside the firewall, and returning a CS registration response message to the CS, and establishing a first long connection with the CS;

接收所述CS通过第一长连接中永远在线引擎AOE的第一长连接转发的AOE注册请求,根据所述AOE注册请求消息为所述AOE创建对应的PS会话Session,记录所述PS Session对应的PS Session ID;Receive the AOE registration request forwarded by the CS through the first persistent connection of the always-on engine AOE in the first persistent connection, create a corresponding PS session session for the AOE according to the AOE registration request message, and record the PS session corresponding PS Session ID;

通过所述AOE的第一长连接向所述CS发送AOE注册应答消息,所述AOE注册应答消息中携带有所述PS Session ID;sending an AOE registration response message to the CS through the first long connection of the AOE, where the AOE registration response message carries the PS Session ID;

接收所述CS通过所述AOE的第一长连接转发的AOE消息,所述AOE消息中携带有所述CS-PS消息头,所述CS-PS消息头中包括AOE标识、PS SessionID和CS Session ID;Receive the AOE message forwarded by the CS through the first long connection of the AOE, the AOE message carries the CS-PS message header, and the CS-PS message header includes the AOE identifier, PS SessionID and CS Session ID;

根据所述AOE标识和PS Session ID定位到AOE的Session,并完成对所述AOE消息的处理;Locate the AOE Session according to the AOE ID and the PS Session ID, and complete the processing of the AOE message;

通过所述AOE的第一长连接向所述CS返回PS消息,所述PS消息中携带有所述CS-PS消息头。Returning a PS message to the CS through the first long connection of the AOE, where the PS message carries the CS-PS message header.

上述方案中,在建立与所述CS之间的至少一个第一长连接之后,所述方法还包括:In the above solution, after establishing at least one first long connection with the CS, the method further includes:

接收所述CS发送的CS负载信息,并将所述CS负载信息发送给状态同步设备;receiving CS load information sent by the CS, and sending the CS load information to a state synchronization device;

接收所述状态同步设备同步的各CS的CS负载信息;receiving CS load information of each CS synchronized by the state synchronization device;

接收AOE发送的通过请求消息,并根据所述各CS的CS负载信息选择出负载最轻的CS,返回通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址。Receive the passing request message sent by the AOE, select the CS with the lightest load according to the CS load information of the CSs, and return a passing response message, the passing response message carrying the IP address of the CS with the lightest load.

一种永远在线业务的实现方法,所述方法应用于用户终端上的永远在线引擎AOE,包括:A method for implementing an always-on service, the method being applied to an always-on engine AOE on a user terminal, including:

向连接服务器CS发送AOE注册请求消息;Send an AOE registration request message to the connection server CS;

接收所述CS转发的AOE注册应答消息;receiving the AOE registration response message forwarded by the CS;

向所述CS发送AOE消息;sending an AOE message to the CS;

接收所述CS转发的推送业务服务器PS消息。Receive the push service server PS message forwarded by the CS.

上述方案中,在向CS发送AOE注册请求消息之前,所述方法还包括:In the above solution, before sending the AOE registration request message to the CS, the method further includes:

向PS发送通过请求消息;Send a pass request message to PS;

接收所述PS返回的通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址;receiving a passing response message returned by the PS, where the passing response message carries the IP address of the CS with the lightest load;

相应的,所述向CS发送AOE注册请求消息,包括:Correspondingly, the sending the AOE registration request message to the CS includes:

向所述负载最轻的CS的IP地址对应的CS发送AOE注册请求消息。An AOE registration request message is sent to the CS corresponding to the IP address of the CS with the lightest load.

一种连接服务器CS,包括:A connection server CS, comprising:

第一发送单元,用于至少一次向部署在防火墙之内的推送业务服务器PS发送CS注册请求消息,所述CS注册请求消息中包括所述CS的IP地址,所述CS的IP地址用于使所述CS注册请求消息通过防火墙至所述PS;The first sending unit is configured to send a CS registration request message to the push service server PS deployed in the firewall at least once, the CS registration request message includes the IP address of the CS, and the IP address of the CS is used to use The CS registration request message passes through the firewall to the PS;

第一接收单元,用于对应接收至少一次所述PS返回的CS注册应答消息,建立与所述PS之间的至少一个第一长连接;The first receiving unit is configured to correspondingly receive at least one CS registration response message returned by the PS, and establish at least one first long connection with the PS;

所述第一接收单元,还用于接收永远在线引擎AOE发送的AOE注册请求消息,根据所述AOE注册请求消息为所述AOE创建对应的CS会话Session,记录所述CS Session对应的CS Session ID;The first receiving unit is further configured to receive the AOE registration request message sent by the always-on engine AOE, create a corresponding CS session session for the AOE according to the AOE registration request message, and record the CS Session ID corresponding to the CS session ;

所述第一发送单元,还用于从所述至少一个第一长连接中选择一个第一长连接为所述AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息;The first sending unit is further configured to select a first long connection from the at least one first long connection as the first long connection of the AOE, and send a message to the PS through the first long connection of the AOE Forwarding the AOE registration request message;

所述第一接收单元,还用于通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息,所述AOE注册应答消息中携带有所述PS为所述AOE创建的PS Session的PS Session ID;The first receiving unit is further configured to receive the AOE registration response message returned by the PS through the first long connection of the AOE, and the AOE registration response message carries the PS Session created by the PS for the AOE PS Session ID;

所述第一发送单元,还用于保存所述PS Session ID,并将所述AOE注册应答消息中的PS Session ID删除后转发给所述AOE;The first sending unit is further configured to save the PS Session ID, delete the PS Session ID in the AOE registration response message and forward it to the AOE;

所述第一接收单元,还用于接收所述AOE发送的AOE消息;The first receiving unit is further configured to receive an AOE message sent by the AOE;

所述第一发送单元,还用于在所述第一接收单元接收的AOE消息上增加一个CS-PS消息头后通过所述AOE的第一长连接转发给所述PS,所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;The first sending unit is further configured to add a CS-PS message header to the AOE message received by the first receiving unit and forward it to the PS through the first long connection of the AOE, and the CS-PS The message header includes AOE ID, PS Session ID and CS Session ID;

所述第一接收单元,还用于通过所述AOE的第一长连接接收所述PS返回的PS消息;The first receiving unit is further configured to receive the PS message returned by the PS through the first long connection of the AOE;

所述第一发送单元,还用于在删除所述第一接收单元接收的PS消息中的CS-PS消息头后转发给所述AOE。The first sending unit is further configured to delete the CS-PS message header in the PS message received by the first receiving unit and forward it to the AOE.

上述方案中,所述第一发送单元,还用于在建立与所述PS之间的至少一个第一长连接后,通过任意一个第一长连接定时向所述PS发送CS负载信息。In the above solution, the first sending unit is further configured to regularly send CS load information to the PS through any first long connection after establishing at least one first long connection with the PS.

一种推送业务服务器PS,包括:A push service server PS, comprising:

第二接收单元,用于接收部署在防火墙之外的连接服务器CS发送的CS注册请求消息;The second receiving unit is configured to receive a CS registration request message sent by a connection server CS deployed outside the firewall;

第二发送单元,用于向所述CS返回CS注册应答消息,建立与所述CS之间的第一长连接;a second sending unit, configured to return a CS registration response message to the CS, and establish a first long connection with the CS;

所述第二接收单元,还用于接收所述CS通过第一长连接中永远在线引擎AOE的第一长连接转发的AOE注册请求,根据所述AOE注册请求消息为所述AOE创建对应的PS会话Session,记录所述PS Session对应的PS Session ID;The second receiving unit is further configured to receive the AOE registration request forwarded by the CS through the first persistent connection of the always-on engine AOE in the first persistent connection, and create a corresponding PS for the AOE according to the AOE registration request message Session Session, recording the PS Session ID corresponding to the PS Session;

所述第二发送单元,还用于通过所述AOE的第一长连接向所述CS发送AOE注册应答消息,所述AOE注册应答消息中携带有所述PS Session ID;The second sending unit is further configured to send an AOE registration response message to the CS through the first long connection of the AOE, and the AOE registration response message carries the PS Session ID;

所述第二接收单元,还用于接收所述CS通过所述AOE的第一长连接转发的AOE消息,所述AOE消息中携带有CS-PS消息头,所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;The second receiving unit is further configured to receive an AOE message forwarded by the CS through the first long connection of the AOE, the AOE message carries a CS-PS message header, and the CS-PS message header includes AOE logo, PS Session ID and CS Session ID;

所述第二发送单元,还用于根据所述第二接收单元接收的AOE标识和PSSession ID定位到AOE的Session,完成对所述AOE消息的处理;并通过所述AOE的第一长连接向所述CS返回PS消息,所述PS消息中携带有所述CS-PS消息头。The second sending unit is further configured to locate the AOE Session according to the AOE identifier and PSSession ID received by the second receiving unit, and complete the processing of the AOE message; The CS returns a PS message, and the PS message carries the CS-PS message header.

上述方案中,所述第二接收单元,还用于在建立与所述CS之间的至少一个第一长连接之后,接收所述CS发送的CS负载信息;In the above solution, the second receiving unit is further configured to receive the CS load information sent by the CS after establishing at least one first long connection with the CS;

所述第二发送单元,还用于将所述第二接收单元接收的CS负载信息发送给状态同步设备;The second sending unit is further configured to send the CS load information received by the second receiving unit to a state synchronization device;

所述第二接收单元,还用于接收所述状态同步设备同步的各CS的CS负载信息;The second receiving unit is further configured to receive CS load information of each CS synchronized by the state synchronization device;

所述第二接收单元,还用于接收AOE发送的通过请求消息;The second receiving unit is further configured to receive a pass request message sent by the AOE;

所述第二发送单元,还用于根据所述第二接收单元接收的各CS的CS负载信息选择出负载最轻的CS,返回通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址。The second sending unit is further configured to select the CS with the lightest load according to the CS load information of each CS received by the second receiving unit, and return a passing response message, the passing response message carrying the CS with the lightest load The IP address of the light CS.

一种永远在线引擎AOE,包括:An always-on engine AOE, including:

第三发送单元,用于向连接服务器CS发送AOE注册请求消息;A third sending unit, configured to send an AOE registration request message to the connection server CS;

第三接收单元,用于接收所述CS转发的AOE注册应答消息;a third receiving unit, configured to receive the AOE registration response message forwarded by the CS;

所述第三发送单元,还用于向所述CS发送AOE消息;The third sending unit is further configured to send an AOE message to the CS;

所述第三接收单元,还用于接收所述CS转发的推送业务服务器PS消息。The third receiving unit is further configured to receive the push service server PS message forwarded by the CS.

上述方案中,所述第三发送单元,还用于在向CS发送AOE注册请求消息之前,向PS发送通过请求消息;In the above solution, the third sending unit is further configured to send a pass request message to the PS before sending the AOE registration request message to the CS;

所述第三接收单元,还用于接收所述PS返回的通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址;The third receiving unit is further configured to receive a pass reply message returned by the PS, where the pass reply message carries the IP address of the CS with the lightest load;

相应的,所述第三发送单元,具体用于向所述负载最轻的CS的IP地址对应的CS发送AOE注册请求消息。Correspondingly, the third sending unit is specifically configured to send an AOE registration request message to the CS corresponding to the IP address of the CS with the lightest load.

本发明实施例提供了一种永远在线业务的实现方法及装置,用户终端的AOE通过CS与PS建立长连接,一个CS下可连接有多个用户终端,每个用户终端上的AOE都对应有一个TCP长连接与CS通信,用户终端上的AOE与CS之间的TCP长连接并不通过防火墙;每个CS与PS之间通过少量TCP长连接通信,多个用户终端可以共用CS与PS之间的一个TCP长连接进行推送业务。随着在线用户终端数量的持续增长,多个用户终端的AOE可以共用一条CS与PS之间的第一长连接,故通过防火墙的第一长连接的数目小于用户终端数量,这就极大降低了通过防火墙的TCP连接数,并且本发明实施例中将涉及到用户终端的数据的PS部署在防火墙内。这样就在保证永远在线终端用户数据安全性和服务器稳定性的前提下,避免防火墙设备的并发连接数随在线用户数增长而大幅增加,降低对防火墙容量的需求,降低运营成本,为用户终端提供安全、稳定、低成本的推送服务。The embodiment of the present invention provides a method and device for implementing an always-on service. The AOE of the user terminal establishes a long connection with the PS through the CS. Multiple user terminals can be connected to one CS, and the AOE on each user terminal corresponds to a A TCP long connection communicates with the CS. The TCP long connection between the AOE on the user terminal and the CS does not pass through the firewall; each CS communicates with the PS through a small number of TCP long connections, and multiple user terminals can share the connection between the CS and the PS. A TCP long-term connection between the push services. As the number of online user terminals continues to grow, the AOE of multiple user terminals can share the first long connection between CS and PS, so the number of first long connections passing through the firewall is smaller than the number of user terminals, which greatly reduces the The number of TCP connections passing through the firewall is measured, and in the embodiment of the present invention, the PS related to the data of the user terminal is deployed in the firewall. In this way, under the premise of ensuring the data security of the always-on terminal users and the stability of the server, the number of concurrent connections of the firewall device will not increase significantly with the increase of the number of online users, reducing the demand for firewall capacity, reducing operating costs, and providing user terminals with Safe, stable, and low-cost push service.

附图说明Description of drawings

图1为现有技术中的一种永远在线业务的系统结构图;Fig. 1 is a system structure diagram of an always-on service in the prior art;

图2为本发明实施例提供的一种永远在线业务的系统结构图;FIG. 2 is a system structural diagram of an always-on service provided by an embodiment of the present invention;

图3为本发明实施例提供的一种永远在线业务的实现方法流程示意图;FIG. 3 is a schematic flowchart of a method for implementing an always-on service provided by an embodiment of the present invention;

图4为本发明实施例提供的一种CS均衡方法流程示意图;FIG. 4 is a schematic flowchart of a CS equalization method provided by an embodiment of the present invention;

图5为本发明实施例提供的一种CS的结构框图;FIG. 5 is a structural block diagram of a CS provided by an embodiment of the present invention;

图6为本发明实施例提供的一种PS的结构框图;FIG. 6 is a structural block diagram of a PS provided by an embodiment of the present invention;

图7为本发明实施例提供的一种AOE的结构框图。FIG. 7 is a structural block diagram of an AOE provided by an embodiment of the present invention.

具体实施方式detailed description

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention.

现有技术中,AOG的功能是建立并维持与用户终端上AOE之间的TCP长连接,通过该TCP长连接进行推送业务。由于AOG需要保存用户终端的相关数据;为了保证这些数据的安全性,避免潜在的网络攻击,保证AOG的稳定性,所以AOG必须部署在防火墙之内;每个在线用户终端独占防火墙设备的一个TCP长连接,随着在线用户终端数量的持续增长,通过防火墙的并发连接数会持续增加。为了解决现有技术中永远在线类业务受防火墙并发连接数限制的问题,本发明实施例是基于如图2所示的系统构架来实现永远在线业务,本发明实施例将现有技术中的AOG分成两个模块,一个模块定义为AOG的连接服务器(CS,Connection Server),另一个模块定义为AOG的推送业务服务器(PS,Push Server)。In the prior art, the function of the AOG is to establish and maintain a TCP persistent connection with the AOE on the user terminal, and to perform push services through the TCP persistent connection. Because AOG needs to save relevant data of user terminals; in order to ensure the security of these data, avoid potential network attacks, and ensure the stability of AOG, AOG must be deployed within the firewall; each online user terminal exclusively occupies a TCP port of the firewall device Long connection, as the number of online user terminals continues to grow, the number of concurrent connections passing through the firewall will continue to increase. In order to solve the problem that the always-on service in the prior art is limited by the number of concurrent connections of the firewall, the embodiment of the present invention is based on the system architecture shown in Figure 2 to realize the always-on service. The embodiment of the present invention combines the AOG in the prior art Divided into two modules, one module is defined as AOG's connection server (CS, Connection Server), and the other module is defined as AOG's push service server (PS, Push Server).

PS涉及到用户终端的数据,对安全性和稳定性要求极高,所以部署在防火墙之内;CS只负责建立并维持与用户终端上AOE之间的长连接,并不涉及到用户数据和系统的核心推送业务,对系统安全性要求相对较低,逻辑相对简单,抗攻击能力较强,故部署在防火墙之外。PS involves the data of user terminals, and has high requirements for security and stability, so it is deployed within the firewall; CS is only responsible for establishing and maintaining long-term connections with AOE on user terminals, and does not involve user data and systems The core push business has relatively low requirements on system security, relatively simple logic, and strong anti-attack capabilities, so it is deployed outside the firewall.

本发明实施例提供的系统中,一个CS下可连接有多个用户终端,每个用户终端上的AOE都对应有一个TCP长连接与CS通信,用户终端上的AOE与CS之间的TCP长连接并不通过防火墙;每个CS与PS之间通过少量TCP长连接通信,多个用户终端可以共用CS与PS之间的一个TCP长连接进行推送业务。由于用户终端上的AOE与CS之间的TCP长连接并不通过防火墙,只有CS与PS之间的少量长连接通过防火墙的,从而极大降低了通过防火墙的TCP连接数,降低了防火墙压力,降低了系统运营成本。In the system provided by the embodiment of the present invention, multiple user terminals can be connected to one CS, and the AOE on each user terminal corresponds to a TCP long connection to communicate with the CS, and the TCP long connection between the AOE on the user terminal and the CS The connection does not pass through the firewall; each CS communicates with the PS through a small number of TCP long connections, and multiple user terminals can share a TCP long connection between the CS and the PS for push services. Since the TCP long connection between AOE and CS on the user terminal does not pass through the firewall, only a small number of long connections between CS and PS pass through the firewall, thus greatly reducing the number of TCP connections passing through the firewall and reducing the pressure on the firewall. Reduced system operating costs.

实施例1Example 1

本发明实施例提供了一种永远在线业务的实现方法,如图3所示,本实施例方法的处理流程包括以下步骤:The embodiment of the present invention provides a method for implementing an always-on service. As shown in FIG. 3 , the processing flow of the method in this embodiment includes the following steps:

步骤301、CS至少一次向部署在防火墙之内的PS发送至少一个CS注册请求消息,PS接收部署在防火墙之外的CS发送的CS注册请求消息。Step 301, the CS sends at least one CS registration request message to the PS deployed inside the firewall at least once, and the PS receives the CS registration request message sent by the CS deployed outside the firewall.

CS启动时,需要通过CS注册流程建立该CS与PS之间的TCP长连接。由于防火墙设备对CS的IP地址进行限制,所以CS注册流程并不需要复杂的认证逻辑。When the CS is started, a TCP persistent connection between the CS and the PS needs to be established through the CS registration process. Since the firewall device restricts the IP address of the CS, the CS registration process does not require complex authentication logic.

启动CS注册流程后,所述CS向PS发送CS注册请求消息,由于CS部署在防火墙之外,PS部署在防火墙内,防火墙需要设置IP地址过滤规则,只有CS可以建立到PS的TCP长连接,保证系统的安全性。所述CS注册请求消息中包括所述CS的IP地址,所述CS的IP地址可以使所述CS注册请求消息通过防火墙至所述PS。After starting the CS registration process, the CS sends a CS registration request message to the PS. Since the CS is deployed outside the firewall and the PS is deployed inside the firewall, the firewall needs to set IP address filtering rules. Only the CS can establish a TCP long connection to the PS. Ensure system security. The CS registration request message includes the CS's IP address, and the CS's IP address enables the CS registration request message to pass through the firewall to the PS.

在这里需要说明的是,本实施例中各设备之间传输的消息都是TCP/IP协议消息,这些消息都遵循TCP/IP协议的规定,数据格式为:It should be noted here that the messages transmitted between the devices in this embodiment are all TCP/IP protocol messages, and these messages follow the regulations of the TCP/IP protocol, and the data format is:

数据帧:帧头+IP数据包+帧尾(帧头包括源和目标主机MAC初步地址及类型,帧尾是校验字);Data frame: frame header + IP data packet + frame tail (the frame header includes the initial MAC addresses and types of the source and target hosts, and the frame tail is the checksum word);

IP数据包:IP头部+TCP数据信息(IP头包括源和目标主机IP地址、类型、生存期等);IP data packet: IP header + TCP data information (IP header includes source and destination host IP address, type, lifetime, etc.);

TCP数据信息:TCP头部+实际数据(TCP头包括源和目标主机端口号、顺序号、确认号、校验字等)。TCP data information: TCP header + actual data (TCP header includes source and destination host port numbers, sequence numbers, confirmation numbers, checksums, etc.).

在此步骤中,源主机为CS,目标主机为PS,CS向PS发送的CS注册请求消息中必然携带有所述CS的IP地址,这样防火墙就可以使所述CS注册请求消息通过到达PS。In this step, the source host is CS, the target host is PS, and the CS registration request message sent by CS to PS must carry the IP address of the CS, so that the firewall can allow the CS registration request message to reach the PS.

所述CS可以多次向PS发送CS注册请求消息,以请求与所述PS之间建立多个TCP长连接,所述CS每次向所述PS发送CS注册请求消息时采用的文件描述符不同。The CS may send a CS registration request message to the PS multiple times to request to establish multiple TCP long connections with the PS, and the CS uses a different file descriptor when sending the CS registration request message to the PS each time .

步骤302、PS向所述CS返回CS注册应答消息,所述CS对应接收至少一次所述PS返回的CS注册应答消息,建立所述CS与所述PS之间的至少一个第一长连接。Step 302, the PS returns a CS registration response message to the CS, and the CS correspondingly receives the CS registration response message returned by the PS at least once, and establishes at least one first long connection between the CS and the PS.

所述PS接收到所述CS发送的CS注册请求消息后,会创建一个Session,并向所述CS返回CS注册应答消息,这样就建立了与所述PS之间的一个第一长连接。所述CS注册应答消息的数据格式遵循TCP/IP协议的规定。After receiving the CS registration request message sent by the CS, the PS will create a Session, and return a CS registration response message to the CS, thus establishing a first long connection with the PS. The data format of the CS registration response message complies with the provisions of the TCP/IP protocol.

该第一长连接建立后,所述CS会定期发送心跳消息,以维持该第一长连接,当第一长连接因为异常断开时,CS需要再次进行步骤301发起CS注册流程,恢复CS与PS之间的第一长连接。After the first long connection is established, the CS will periodically send heartbeat messages to maintain the first long connection. When the first long connection is disconnected due to abnormality, the CS needs to perform step 301 again to initiate the CS registration process, and restore the CS and The first longest connection between PSs.

所述CS可以多次向PS发送CS注册请求消息,所述PS可以根据每次接收的CS注册请求消息,创建一个该CS对应的Session,并向所述CS返回对应的CS注册应答消息,这样每次注册完成后就可以建立一个CS与PS之间的第一长连接。即对于一个CS和对应的一个PS来说,所述CS与PS之间可以建立有多个第一长连接,这几个长连接之间是相互独立的。多个第一长连接可实现CS和PS间的负载均衡和故障切换,当某个第一长连接异常时,CS可通过注册流程只恢复异常连接,并不影响其他的第一长连接,且CS与PS之间仍可以应用其他正常的第一长连接为其他用户终端的AOE提供服务。The CS may send a CS registration request message to the PS multiple times, and the PS may create a session corresponding to the CS according to the received CS registration request message each time, and return a corresponding CS registration response message to the CS, so that After each registration is completed, a first long connection between the CS and the PS can be established. That is, for a CS and a corresponding PS, multiple first long connections may be established between the CS and the PS, and these long connections are independent of each other. Multiple first long-term connections can realize load balancing and failover between CS and PS. When a first long-term connection is abnormal, CS can only restore the abnormal connection through the registration process without affecting other first long-term connections, and Another normal first long connection can still be used between the CS and the PS to provide services for the AOE of other user terminals.

步骤303、AOE向CS发送AOE注册请求消息,CS接收AOE发送的AOE注册请求消息,根据所述AOE注册请求消息为所述AOE创建对应的CS Session,记录所述CS Session对应的CS Session ID。Step 303, the AOE sends an AOE registration request message to the CS, and the CS receives the AOE registration request message sent by the AOE, creates a corresponding CS Session for the AOE according to the AOE registration request message, and records the CS Session ID corresponding to the CS Session.

在CS与PS之间的第一长连接建立后,所述用户终端上的AOE就可以启动AOE注册流程,建立该AOE与PS之间的长连接,这样PS就可以通过该长连接向AOE推送数据。AOE启动注册时,所述AOE会将AOE注册请求消息发送给CS,所述CS接收AOE发送的AOE注册请求消息。After the first long connection between the CS and the PS is established, the AOE on the user terminal can start the AOE registration process and establish a long connection between the AOE and the PS, so that the PS can push the AOE to the AOE through the long connection. data. When the AOE starts registration, the AOE sends an AOE registration request message to the CS, and the CS receives the AOE registration request message sent by the AOE.

所述AOE注册请求消息的数据格式遵循TCP/IP协议的规定。The data format of the AOE registration request message follows the provisions of the TCP/IP protocol.

所述CS接收到该AOE发送的AOE注册请求消息后,会创建该AOE对应的CS Session,记录该CS Session对应的CS Session ID。After receiving the AOE registration request message sent by the AOE, the CS will create a CS Session corresponding to the AOE, and record the CS Session ID corresponding to the CS Session.

步骤304、CS从所述至少一个第一长连接中选择一个第一长连接为所述AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息,PS接收所述CS通过AOE的第一长连接转发的AOE注册请求。Step 304, the CS selects a first persistent connection from the at least one first persistent connection as the first persistent connection of the AOE, and forwards the AOE registration request to the PS through the first persistent connection of the AOE message, the PS receives the AOE registration request forwarded by the CS through the first long connection of the AOE.

所述CS接收到AOE注册请求消息后,会从所述CS与PS之间的至少一个第一长连接中选择出一个第一长连接为所述AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息。After the CS receives the AOE registration request message, it will select a first long connection from at least one first long connection between the CS and the PS as the first long connection of the AOE, and pass the AOE The first long connection forwards the AOE registration request message to the PS.

步骤305、PS根据所述AOE注册请求消息为所述AOE创建对应的PSSession,记录所述PS Session对应的PS Session ID,通过所述AOE的第一长连接向CS返回的AOE注册应答消息,所述CS接收所述AOE注册应答消息,其中,所述AOE注册应答消息携带有所述PS Session ID。Step 305, the PS creates a corresponding PSSession for the AOE according to the AOE registration request message, records the PS Session ID corresponding to the PS Session, and returns the AOE registration response message to the CS through the first long connection of the AOE, so The CS receives the AOE registration response message, where the AOE registration response message carries the PS Session ID.

所述PS通过所述AOE的第一长连接接收到所述AOE注册请求消息后,会创建该AOE对应的PS Session,并通过所述AOE的第一长连接向所述CS返回AOE注册应答消息,所述AOE注册应答消息中携带有所述PS Session对应的PS Session ID。所述CS通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息。After the PS receives the AOE registration request message through the first long connection of the AOE, it will create a PS Session corresponding to the AOE, and return an AOE registration response message to the CS through the first long connection of the AOE , the AOE registration response message carries the PS Session ID corresponding to the PS Session. The CS receives the AOE registration response message returned by the PS through the first persistent connection of the AOE.

步骤306、所述CS保存所述PS Session ID,并将所述AOE注册应答消息中的PS Session ID删除后转发给所述AOE,所述AOE接收AOE注册应答消息。Step 306, the CS saves the PS Session ID, deletes the PS Session ID in the AOE registration response message and forwards it to the AOE, and the AOE receives the AOE registration response message.

所述CS通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息后,保存所述AOE注册应答消息中的PS Session ID,并将所述AOE注册应答消息中的PS Session ID删除后转发给所述AOE。After the CS receives the AOE registration response message returned by the PS through the first long connection of the AOE, it saves the PS Session ID in the AOE registration response message, and stores the PS Session ID in the AOE registration response message After deletion, it is forwarded to the AOE.

这样就建立了该AOE与PS之间的TCP长连接,AOE与PS之间的TCP长连接包括AOE与CS之间的TCP长连接,以及CS与PS之间的第一长连接。In this way, the TCP long connection between the AOE and the PS is established, and the TCP long connection between the AOE and the PS includes the TCP long connection between the AOE and the CS, and the first long connection between the CS and the PS.

可以有多个AOE都通过一个CS注册到一个PS上,示例的,如图2所示,用户终端A的AOE与该CS之间对应有一个TCP长连接,用户终端B的AOE与该CS之间也对应有一个TCP长连接,该CS与PS之间只有一个第一长连接,用户终端A的AOE与用户终端B的AOE可以共用该CS与PS之间的这一个第一长连接与PS进行通信。Multiple AOEs can be registered to one PS through one CS. For example, as shown in Figure 2, there is a corresponding TCP long connection between the AOE of user terminal A and the CS, and the connection between the AOE of user terminal B and the CS There is also a TCP long connection between the CS and the PS. There is only one first long connection between the CS and the PS. The AOE of the user terminal A and the AOE of the user terminal B can share the first long connection between the CS and the PS and the PS to communicate.

在有N个用户终端的情况下,现有技术防火墙需要支持N个TCP长连接,采用本实施例方法,N个用户终端与CS之间需要有N条TCP长连接,但是这N条TCP长连接并不通过防火墙,而多个用户终端的AOE可以共用一条CS与PS之间的第一长连接,故第一长连接的数目必然小于N,即通过防火墙的第一长连接的数目小于N,这就极大降低了通过防火墙的TCP连接数,降低了防火墙压力,降低了系统运营成本。In the case where there are N user terminals, the firewall in the prior art needs to support N TCP long connections. Using the method of this embodiment, there need to be N TCP long connections between the N user terminals and the CS, but the N TCP long connections The connection does not pass through the firewall, and the AOE of multiple user terminals can share the first long connection between CS and PS, so the number of first long connections must be less than N, that is, the number of first long connections passing through the firewall is less than N , which greatly reduces the number of TCP connections passing through the firewall, reduces the pressure on the firewall, and reduces the operating cost of the system.

步骤307、AOE向CS发送AOE消息,CS接收所述AOE发送的AOE消息。Step 307, the AOE sends an AOE message to the CS, and the CS receives the AOE message sent by the AOE.

步骤308、所述CS在所述AOE消息上增加一个CS-PS消息头后通过所述AOE的第一长连接转发给所述PS,所述PS接收所述CS通过所述AOE的第一长连接转发的AOE消息。Step 308: The CS adds a CS-PS message header to the AOE message and forwards it to the PS through the first long connection of the AOE, and the PS receives the first long connection of the CS through the AOE The AOE message forwarded by the connection.

AOE完成注册流程后,所述AOE与所述PS之间就可以进行消息传输。所述AOE可以向所述CS发送AOE消息,所述CS可以通过所述AOE注册时选定的所述AOE的第一长连接将所述AOE消息转发给所述PS。After the AOE completes the registration process, message transmission can be performed between the AOE and the PS. The AOE may send an AOE message to the CS, and the CS may forward the AOE message to the PS through the first persistent connection of the AOE selected during the AOE registration.

由于多个用户终端的AOE可以共用一个第一长连接,故所述CS在应用所述AOE的第一长连接将所述AOE消息转发给所述PS时,需要给所述AOE消息增加CS-PS消息头,以区分该AOE消息是属于哪个用户终端的AOE的。Since the AOEs of multiple user terminals can share a first long connection, when the CS uses the first long connection of the AOE to forward the AOE message to the PS, it needs to add CS- PS message header, so as to distinguish which AOE of the user terminal the AOE message belongs to.

所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;其中,The CS-PS message header includes AOE identification, PS Session ID and CS Session ID; wherein,

AOE标识:系统内部用户终端的AOE的唯一标识;AOE identification: the unique identification of the AOE of the user terminal inside the system;

PS Session ID:PS为该用户终端的AOE创建的Session的ID,PS利用PSSession ID可以快速定位用户终端的AOE在PS上的Session对象(AOE在PS上的Session对象为所述PS在进行步骤305时创建,并在注册流程时将对应的PS Session ID发送给CS);PS Session ID: the ID of the Session created by the PS for the AOE of the user terminal, the PS can quickly locate the Session object of the AOE of the user terminal on the PS by using the PSSession ID (the Session object of the AOE on the PS is that the PS is performing step 305 , and send the corresponding PS Session ID to CS during the registration process);

CS Session ID:CS为该用户终端的AOE创建的Session的ID,CS利用CS Session ID可以快速定位用户终端的AOE在CS上的Session对象(AOE在CS上的Session对象为所述CS在进行步骤303时创建,CS自己记录有对应的CS Session ID)。CS Session ID: The ID of the Session created by the CS for the AOE of the user terminal. The CS can quickly locate the Session object of the AOE of the user terminal on the CS by using the CS Session ID (the Session object of the AOE on the CS is the process in progress of the CS) 303, CS itself records the corresponding CS Session ID).

步骤309、PS根据所述AOE标识和PS Session ID定位到AOE的Session,完成对所述AOE消息处理,并通过所述AOE的第一长连接向CS返回的PS消息,所述CS接收所述PS消息。Step 309, the PS locates the Session of the AOE according to the AOE identifier and the PS Session ID, completes the processing of the AOE message, and returns the PS message to the CS through the first long connection of the AOE, and the CS receives the PS news.

所述PS接收到CS转发的AOE消息后,根据CS-PS消息头中的AOE标识和PS Session ID定位到该AOE的Session对象,并完成对所述AOE消息处理;然后所述PS会构建PS消息,所述PS消息中也需要携带有所述CS-PS消息头。After the PS receives the AOE message forwarded by the CS, it locates the Session object of the AOE according to the AOE identifier and the PS Session ID in the CS-PS message header, and completes the processing of the AOE message; then the PS constructs a PS message, the PS message also needs to carry the CS-PS message header.

步骤310、所述CS删除所述PS消息中的CS-PS消息头后转发给所述AOE,所述AOE接收所述CS转发的PS消息。Step 310, the CS deletes the CS-PS message header in the PS message and forwards it to the AOE, and the AOE receives the PS message forwarded by the CS.

所述CS接收到PS发送的PS消息后,根据所述CS-PS消息头中的CSSession ID,定位用户终端的AOE的Session对象,并去除所述CS-PS消息头,只将消息内容转发给用户终端的AOE,这样就实现了PS与AOE的通信。After the CS receives the PS message sent by the PS, it locates the AOE Session object of the user terminal according to the CSSession ID in the CS-PS message header, removes the CS-PS message header, and only forwards the message content to The AOE of the user terminal, thus realizing the communication between PS and AOE.

PS主动向用户终端的AOE推送数据业务时,所述PS会首先从其他设备获取要推送的内容,推送目标AOE的信息即AOE标识、PS Session ID和CSSession ID;然后将其构建成PS消息发送给CS,所述CS接收到PS发送的PS消息后,根据所述CS-PS消息头中的CS Session ID,定位用户终端的AOE的Session对象,并去除所述CS-PS消息头,只将推送的内容转发给用户终端的AOE,这样PS就主动将推送的内容下发给了用户终端的AOE。When the PS actively pushes data services to the AOE of the user terminal, the PS will first obtain the content to be pushed from other devices, and push the information of the target AOE, namely the AOE ID, PS Session ID and CSSession ID; and then construct it into a PS message to send To the CS, after the CS receives the PS message sent by the PS, according to the CS Session ID in the CS-PS message header, locate the Session object of the AOE of the user terminal, and remove the CS-PS message header, and only The pushed content is forwarded to the AOE of the user terminal, so that the PS actively sends the pushed content to the AOE of the user terminal.

为提升AOG系统容量和可用性,防火墙外可以部署多个CS,通过线性扩展,可以支持海量用户请求。由于用户终端上的AOE直接连接CS,AOE与CS之间没有负载均衡器设备,不同的AOE可以连接到不同CS,因此,AOG系统需要实现CS负载均衡逻辑,从而保证CS之间的负载基本均衡。In order to improve the capacity and availability of the AOG system, multiple CSs can be deployed outside the firewall, and through linear expansion, it can support massive user requests. Since the AOE on the user terminal is directly connected to the CS, there is no load balancer device between the AOE and the CS, and different AOEs can be connected to different CSs. Therefore, the AOG system needs to implement CS load balancing logic to ensure that the load between CSs is basically balanced. .

本实施例在PS集群中,部署了状态同步设备,通过PS和状态同步设备可以实现CS的负载均衡,如图4所示,具体方法包括以下步骤:In this embodiment, a state synchronization device is deployed in the PS cluster, and the load balancing of the CS can be realized through the PS and the state synchronization device, as shown in FIG. 4 , the specific method includes the following steps:

步骤401、CS通过任意一个第一长连接定时向所述PS发送CS负载信息,所述PS接收所述CS发送的CS负载信息。Step 401, the CS regularly sends CS load information to the PS through any first long connection, and the PS receives the CS load information sent by the CS.

在步骤302之后,所述CS与PS之间建立了至少一个第一长连接,所述CS通过任意一个第一长连接定时向所述PS发送CS负载信息,所述PS接收所述CS发送的CS负载信息。所述负载信息包括该CS负载的用户终端的AOE的数量。After step 302, at least one first long connection is established between the CS and the PS, the CS regularly sends CS load information to the PS through any one of the first long connections, and the PS receives the information sent by the CS CS load information. The load information includes the number of AOEs of user terminals loaded by the CS.

步骤402、PS将所述CS负载信息发送给状态同步设备。Step 402, the PS sends the CS load information to the state synchronization device.

任一个PS接收到CS发送的CS负载信息后,都会将所述CS负载信息发送给状态同步设备。After any PS receives the CS load information sent by the CS, it will send the CS load information to the state synchronization device.

步骤403、所述状态同步设备同步各CS的CS负载信息到所有PS,各PS接收所述状态同步设备同步的各CS的CS负载信息。Step 403, the state synchronization device synchronizes the CS load information of each CS to all PSs, and each PS receives the CS load information of each CS synchronized by the state synchronization device.

所述状态同步设备可以接收到各PS同步过来的各CS的CS负载信息,所述状态同步设备会将该CS的CS负载信息同步下发给所有PS,这样所有PS就可以获取各CS的CS负载信息。The state synchronization device can receive the CS load information of each CS synchronized by each PS, and the state synchronization device will synchronously send the CS load information of the CS to all PSs, so that all PSs can obtain the CS load information of each CS. load information.

步骤404、AOE向CS发送AOE注册请求消息之前,向PS发送通过请求消息,所述PS接收AOE发送的通过请求消息。Step 404, before the AOE sends the AOE registration request message to the CS, it sends a pass request message to the PS, and the PS receives the pass request message sent by the AOE.

AOE在向CS发送AOE注册请求消息之前,会先向PS发送通过请求消息,请求PS为其分配一个CS来进行注册。Before sending the AOE registration request message to the CS, the AOE will first send a pass request message to the PS, requesting the PS to allocate a CS for registration.

步骤405、PS根据所述各CS的CS负载信息选择出负载最轻的CS,返回通过应答消息,所述AOE接收所述PS返回的通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址。Step 405, the PS selects the CS with the lightest load according to the CS load information of each CS, and returns a passing response message, and the AOE receives the passing response message returned by the PS, and the passing response message carries the load The IP address of the lightest CS.

由于步骤401-403,所有PS都可以获取各CS的CS负载信息,故所述PS可以根据所述各CS的CS负载信息选择出负载最轻的CS,返回通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址。Due to steps 401-403, all PSs can obtain the CS load information of each CS, so the PS can select the CS with the lightest load according to the CS load information of each CS, and return a pass response message, and the pass response message carries the IP address of the CS with the lightest load.

在步骤404-405中,所述AOE与PS之间通过建立TCP短连接进行通信,通过请求消息处理完成后,该TCP短连接会自动断开,因此,步骤404-405中应用到的TCP短连接,不会对防火墙造成巨大压力。In steps 404-405, the AOE and the PS communicate by establishing a TCP short connection. After the processing of the request message is completed, the TCP short connection will be automatically disconnected. Therefore, the TCP short connection applied in steps 404-405 connection without putting a huge strain on the firewall.

步骤406、向所述负载最轻的CS的IP地址对应的CS发送AOE注册请求消息。Step 406, sending an AOE registration request message to the CS corresponding to the IP address of the CS with the lightest load.

AOE根据返回的CS的IP地址,向所述负载最轻的CS的IP地址对应的CS发起注册流程(参考步骤303),建立TCP长连接,由于返回的通过应答消息中携带的是负载最轻的CS的IP地址,故AOE会优先注册到负载最轻的CS,从而实现了CS的负载均衡。According to the IP address of the returned CS, the AOE initiates a registration process to the CS corresponding to the IP address of the CS with the lightest load (refer to step 303), and establishes a TCP long connection. Therefore, the AOE will preferentially register to the CS with the lightest load, thus realizing load balancing of CSs.

实施例2Example 2

本发明实施例提供了一种CS,如图5所示,所述CS包括:第一发送单元501和第一接收单元502,其中,An embodiment of the present invention provides a CS. As shown in FIG. 5 , the CS includes: a first sending unit 501 and a first receiving unit 502, wherein,

第一发送单元501,用于至少一次向部署在防火墙之内的推送业务服务器PS发送CS注册请求消息,所述CS注册请求消息中包括所述CS的IP地址,所述CS的IP地址用于使所述CS注册请求消息通过防火墙至所述PS;The first sending unit 501 is configured to send a CS registration request message to the push service server PS deployed in the firewall at least once, the CS registration request message includes the IP address of the CS, and the IP address of the CS is used for passing the CS registration request message through the firewall to the PS;

第一接收单元502,用于对应接收至少一次所述PS返回的CS注册应答消息,建立与所述PS之间的至少一个第一长连接;The first receiving unit 502 is configured to correspondingly receive at least one CS registration response message returned by the PS, and establish at least one first long connection with the PS;

所述第一接收单元502,还用于接收永远在线引擎AOE发送的AOE注册请求消息,根据所述AOE注册请求消息为所述AOE创建对应的CS会话Session,记录所述CS Session对应的CS Session ID;The first receiving unit 502 is further configured to receive the AOE registration request message sent by the always-on engine AOE, create a corresponding CS session session for the AOE according to the AOE registration request message, and record the CS session corresponding to the CS session ID;

所述第一发送单元501,还用于从所述至少一个第一长连接中选择一个第一长连接为所述AOE的第一长连接,并通过所述AOE的第一长连接向所述PS转发所述AOE注册请求消息;The first sending unit 501 is further configured to select a first long connection from the at least one first long connection as the first long connection of the AOE, and send a message to the AOE through the first long connection of the AOE The PS forwards the AOE registration request message;

所述第一接收单元502,还用于通过所述AOE的第一长连接接收所述PS返回的AOE注册应答消息,所述AOE注册应答消息中携带有所述PS为所述AOE创建的PS Session的PS Session ID;The first receiving unit 502 is further configured to receive the AOE registration response message returned by the PS through the first long connection of the AOE, and the AOE registration response message carries the PS created by the PS for the AOE Session PS Session ID;

所述第一发送单元501,还用于保存所述PS Session ID,并将所述AOE注册应答消息中的PS Session ID删除后转发给所述AOE;The first sending unit 501 is further configured to save the PS Session ID, delete the PS Session ID in the AOE registration response message and forward it to the AOE;

所述第一接收单元502,还用于接收所述AOE发送的AOE消息;The first receiving unit 502 is further configured to receive the AOE message sent by the AOE;

所述第一发送单元501,还用于在所述第一接收单元502接收的AOE消息上增加一个CS-PS消息头后通过所述AOE的第一长连接转发给所述PS,所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;The first sending unit 501 is further configured to add a CS-PS message header to the AOE message received by the first receiving unit 502 and forward it to the PS through the first long connection of the AOE, and the CS -PS message header includes AOE logo, PS Session ID and CS Session ID;

所述第一接收单元502,还用于通过所述AOE的第一长连接接收所述PS返回的PS消息;The first receiving unit 502 is further configured to receive the PS message returned by the PS through the first long connection of the AOE;

所述第一发送单元501,还用于在删除所述第一接收单元502接收的PS消息中的CS-PS消息头后转发给所述AOE。The first sending unit 501 is further configured to delete the CS-PS message header in the PS message received by the first receiving unit 502 and forward it to the AOE.

可选的,所述第一发送单元501,还用于在建立与所述PS之间的至少一个第一长连接后,通过任意一个第一长连接定时向所述PS发送CS负载信息。Optionally, the first sending unit 501 is further configured to, after establishing at least one first long connection with the PS, periodically send CS load information to the PS through any first long connection.

本发明实施例还提供了一种PS,如图6所示,所述PS包括:第二接收单元601和第二发送单元602;其中,The embodiment of the present invention also provides a PS. As shown in FIG. 6, the PS includes: a second receiving unit 601 and a second sending unit 602; wherein,

第二接收单元601,用于接收部署在防火墙之外的连接服务器CS发送的CS注册请求消息;The second receiving unit 601 is configured to receive a CS registration request message sent by a connection server CS deployed outside the firewall;

第二发送单元602,用于向所述CS返回CS注册应答消息,建立与所述CS之间的第一长连接;The second sending unit 602 is configured to return a CS registration response message to the CS, and establish a first long connection with the CS;

第二接收单元601,还用于接收所述CS通过第一长连接中永远在线引擎AOE的第一长连接转发的AOE注册请求,根据所述AOE注册请求消息为所述AOE创建对应的PS会话Session,记录所述PS Session对应的PS Session ID;The second receiving unit 601 is further configured to receive the AOE registration request forwarded by the CS through the first persistent connection of the always-on engine AOE in the first persistent connection, and create a corresponding PS session for the AOE according to the AOE registration request message Session, recording the PS Session ID corresponding to the PS Session;

所述第二发送单元602,还用于通过所述AOE的第一长连接向所述CS发送AOE注册应答消息,所述AOE注册应答消息中携带有所述PS Session ID;The second sending unit 602 is further configured to send an AOE registration response message to the CS through the first long connection of the AOE, where the AOE registration response message carries the PS Session ID;

第二接收单元601,还用于接收所述CS通过所述AOE的第一长连接转发的AOE消息,所述AOE消息中携带有CS-PS消息头,所述CS-PS消息头中包括AOE标识、PS Session ID和CS Session ID;The second receiving unit 601 is further configured to receive the AOE message forwarded by the CS through the first long connection of the AOE, the AOE message carries a CS-PS message header, and the CS-PS message header includes the AOE Logo, PS Session ID and CS Session ID;

所述第二发送单元602,还用于根据所述第二接收单元601接收的AOE标识和PS Session ID定位到AOE的Session,完成对所述AOE消息的处理;并通过所述AOE的第一长连接向所述CS返回PS消息,所述PS消息中携带有所述CS-PS消息头。The second sending unit 602 is further configured to locate the AOE Session according to the AOE identifier and PS Session ID received by the second receiving unit 601, and complete the processing of the AOE message; and through the first session of the AOE The persistent connection returns a PS message to the CS, and the PS message carries the CS-PS message header.

可选的,第二接收单元601,还用于在建立与所述CS之间的至少一个第一长连接之后,接收所述CS发送的CS负载信息;Optionally, the second receiving unit 601 is further configured to receive CS load information sent by the CS after establishing at least one first long connection with the CS;

所述第二发送单元602,还用于将所述第二接收单元601接收的CS负载信息发送给状态同步设备;The second sending unit 602 is further configured to send the CS load information received by the second receiving unit 601 to the state synchronization device;

第二接收单元601,还用于接收所述状态同步设备同步的各CS的CS负载信息;The second receiving unit 601 is further configured to receive CS load information of each CS synchronized by the state synchronization device;

第二接收单元601,还用于接收AOE发送的通过请求消息;The second receiving unit 601 is also configured to receive the pass request message sent by the AOE;

所述第二发送单元602,还用于根据所述第二接收单元601接收的各CS的CS负载信息选择出负载最轻的CS,返回通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址。The second sending unit 602 is further configured to select the CS with the lightest load according to the CS load information of each CS received by the second receiving unit 601, and return a passing response message, the passing response message carrying the IP address of the CS with the lightest load.

本发明实施例还提供了一种AOE,如图7所示,所述AOE包括:第三发送单元701和第三接收单元702,其中,The embodiment of the present invention also provides an AOE. As shown in FIG. 7, the AOE includes: a third sending unit 701 and a third receiving unit 702, wherein,

第三发送单元701,用于向连接服务器CS发送AOE注册请求消息;The third sending unit 701 is configured to send an AOE registration request message to the connection server CS;

第三接收单元702,用于接收所述CS转发的AOE注册应答消息;The third receiving unit 702 is configured to receive the AOE registration response message forwarded by the CS;

所述第三发送单元701,还用于向所述CS发送AOE消息;The third sending unit 701 is further configured to send an AOE message to the CS;

所述第三接收单元702,还用于接收所述CS转发的推送业务服务器PS消息。The third receiving unit 702 is further configured to receive the push service server PS message forwarded by the CS.

可选的,所述第三发送单元701,还用于在向CS发送AOE注册请求消息之前,向PS发送通过请求消息;Optionally, the third sending unit 701 is further configured to send a pass request message to the PS before sending the AOE registration request message to the CS;

所述第三接收单元702,还用于接收所述PS返回的通过应答消息,所述通过应答消息中携带有所述负载最轻的CS的IP地址;The third receiving unit 702 is further configured to receive a passing response message returned by the PS, where the passing response message carries the IP address of the CS with the lightest load;

相应的,所述第三发送单元701,具体用于向所述第三接收单元702接收到的负载最轻的CS的IP地址对应的CS发送AOE注册请求消息。Correspondingly, the third sending unit 701 is specifically configured to send the AOE registration request message to the CS corresponding to the IP address of the CS with the lightest load received by the third receiving unit 702 .

在实际应用中,本实施例中所述的第一发送单元501和第一接收单元502可以由CS上的中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)或现场可编程门阵列(FPGA)等器件实现。本实施例中所述的第二接收单元601和第二发送单元602可以由PS上的中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)或现场可编程门阵列(FPGA)等器件实现。本实施例中所述的第三发送单元701和第三接收单元702可以由测试仪表上的中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)或现场可编程门阵列(FPGA)等器件实现。In practical applications, the first sending unit 501 and the first receiving unit 502 described in this embodiment may be composed of a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or Field Programmable Gate Array (FPGA) and other devices to achieve. The second receiving unit 601 and the second sending unit 602 described in this embodiment can be composed of a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array on the PS. (FPGA) and other devices to achieve. The third sending unit 701 and the third receiving unit 702 described in this embodiment can be composed of a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate on the test instrument Array (FPGA) and other devices to achieve.

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) having computer-usable program code embodied therein.

本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (12)

1. A method for implementing an always-on service, which is applied to a Connection Server (CS) deployed outside a firewall, includes:
sending a CS registration request message to a push service server (PS) deployed in a firewall at least once, wherein the CS registration request message comprises an IP address of the CS, and the IP address of the CS is used for enabling the CS registration request message to pass through the firewall to the PS;
correspondingly receiving CS registration response messages returned by the PS at least once, and establishing at least one first long connection with the PS;
receiving an AOE registration request message sent by an always online engine AOE, creating a corresponding CS Session for the AOE according to the AOE registration request message, and recording a CS Session ID corresponding to the CS Session;
selecting one first long connection from the at least one first long connection as the first long connection of the AOE, and forwarding the AOE registration request message to the PS through the first long connection of the AOE;
receiving an AOE registration response message returned by the PS through a first long connection of the AOE, wherein the AOE registration response message carries a PSSession ID of a PS Session created by the PS for the AOE;
the CS saves the PS Session ID, deletes the PS Session ID in the AOE registration response message and forwards the PSSession ID to the AOE;
receiving an AOE message sent by the AOE, adding a CS-PS message header to the AOE message, and forwarding the AOE message to the PS through the first long connection of the AOE, wherein the CS-PS message header comprises an AOE identifier, a PS Session ID and a CS Session ID;
and receiving the PS message returned by the PS through the first long connection of the AOE, deleting the CS-PS message header in the PS message, and forwarding the CS-PS message header to the AOE.
2. The method of claim 1, wherein after establishing at least one first long connection with the PS, the method further comprises:
and sending the CS load information to the PS through any one first long connection timing.
3. A method for implementing an always-on service is applied to a push service server PS deployed outside a firewall, and includes:
receiving a CS registration request message sent by a Connection Server (CS) deployed outside a firewall, returning a CS registration response message to the CS, and establishing a first long connection with the CS;
receiving an AOE registration request forwarded by the CS through a first long connection of an always-on engine AOE in the first long connection, creating a corresponding PS Session for the AOE according to the AOE registration request message, and recording a PS Session ID corresponding to the PS Session;
sending an AOE registration response message to the CS through the first long connection of the AOE, wherein the AOE registration response message carries the PS Session ID;
receiving an AOE message forwarded by the CS through a first long connection of the AOE, wherein the AOE message carries the CS-PS message header, and the CS-PS message header comprises an AOE identifier, a PS Session ID and a CS Session ID;
positioning the Session of the AOE according to the AOE identification and the PS Session ID, and finishing the processing of the AOE message;
and returning a PS message to the CS through the first long connection of the AOE, wherein the PS message carries the CS-PS message header.
4. The method of claim 3, wherein after establishing at least one first long connection with the CS, the method further comprises:
receiving CS load information sent by the CS, and sending the CS load information to state synchronization equipment;
receiving CS load information of each CS synchronized by the state synchronization equipment;
and receiving a passing request message sent by the AOE, selecting the CS with the lightest load according to the CS load information of all the CSs, and returning a passing response message, wherein the passing response message carries the IP address of the CS with the lightest load.
5. A method for implementing an always-on service, the method being applied to an always-on engine AOE on a user terminal, and comprising:
sending an AOE registration request message to a connection server CS;
receiving the AOE registration response message forwarded by the CS;
sending an AOE message to the CS;
and receiving the PS message of the push service server forwarded by the CS.
6. The method of claim 5, wherein before sending the AOE registration request message to the CS, the method further comprises:
sending a pass request message to the PS;
receiving a passing response message returned by the PS, wherein the passing response message carries the IP address of the CS with the lightest load;
correspondingly, the sending the AOE registration request message to the CS includes:
and sending an AOE registration request message to the CS corresponding to the IP address of the CS with the lightest load.
7. A connection server CS, comprising:
a first sending unit, configured to send a CS registration request message to a push service server PS deployed within a firewall at least once, where the CS registration request message includes an IP address of the CS, and the IP address of the CS is used to enable the CS registration request message to pass through the firewall to the PS;
a first receiving unit, configured to correspondingly receive a CS registration response message returned by the PS at least once, and establish at least one first long connection with the PS;
the first receiving unit is further configured to receive an AOE registration request message sent by an always online engine AOE, create a corresponding CS Session for the AOE according to the AOE registration request message, and record a CS Session ID corresponding to the CS Session;
the first sending unit is further configured to select one first long connection from the at least one first long connection as the first long connection of the AOE, and forward the AOE registration request message to the PS through the first long connection of the AOE;
the first receiving unit is further configured to receive, through the first long connection of the AOE, an AOE registration response message returned by the PS, where the AOE registration response message carries a PS Session ID of a PS Session created by the PS for the AOE;
the first sending unit is further configured to store the PS Session ID, delete the PS Session ID in the AOE registration response message, and forward the deleted PS Session ID to the AOE;
the first receiving unit is further configured to receive an AOE message sent by the AOE;
the first sending unit is further configured to forward a CS-PS message header to the PS through the first long connection of the AOE after adding a CS-PS message header to the AOE message received by the first receiving unit, where the CS-PS message header includes an AOE identifier, a PS Session ID, and a CS Session ID;
the first receiving unit is further configured to receive, through the first long connection of the AOE, a PS message returned by the PS;
the first sending unit is further configured to forward the CS-PS message header to the AOE after deleting the CS-PS message header in the PS message received by the first receiving unit.
8. The CS according to claim 7,
the first sending unit is further configured to send CS load information to the PS at any one first long connection timing after at least one first long connection with the PS is established.
9. A push service server PS, comprising:
a second receiving unit, configured to receive a CS registration request message sent by a connection server CS deployed outside a firewall;
a second sending unit, configured to return a CS registration response message to the CS, and establish a first long connection with the CS;
the second receiving unit is further configured to receive an AOE registration request forwarded by the CS through a first long connection of an always-on engine AOE in the first long connection, create a corresponding PS Session for the AOE according to the AOE registration request message, and record a PS Session ID corresponding to the PS Session;
the second sending unit is further configured to send an AOE registration response message to the CS through the first long connection of the AOE, where the AOE registration response message carries the PS Session ID;
the second receiving unit is further configured to receive an AOE message forwarded by the CS through the first long connection of the AOE, where the AOE message carries a CS-PS message header, and the CS-PS message header includes an AOE identifier, a PS Session ID, and a CS Session ID;
the second sending unit is further configured to locate the Session of the AOE according to the AOE identifier and the PSSession ID received by the second receiving unit, and complete processing of the AOE message; and returning a PS message to the CS through the first long connection of the AOE, wherein the PS message carries the CS-PS message header.
10. The PS according to claim 9,
the second receiving unit is further configured to receive CS load information sent by the CS after at least one first long connection with the CS is established;
the second sending unit is further configured to send the CS load information received by the second receiving unit to a state synchronization device;
the second receiving unit is further configured to receive CS load information of each CS synchronized by the state synchronization device;
the second receiving unit is further configured to receive a pass request message sent by the AOE;
the second sending unit is further configured to select a CS with the lightest load according to the CS load information of each CS received by the second receiving unit, and return a passing response message, where the passing response message carries an IP address of the CS with the lightest load.
11. An always-on engine, AOE, comprising:
a third sending unit, configured to send an AOE registration request message to the connection server CS;
a third receiving unit, configured to receive the AOE registration response message forwarded by the CS;
the third sending unit is further configured to send an AOE message to the CS;
the third receiving unit is further configured to receive a PS message of the push service server forwarded by the CS.
12. The AOE of claim 11,
the third sending unit is further configured to send a pass request message to the PS before sending the AOE registration request message to the CS;
the third receiving unit is further configured to receive a passing response message returned by the PS, where the passing response message carries the IP address of the CS with the lightest load;
correspondingly, the third sending unit is specifically configured to send an AOE registration request message to the CS corresponding to the IP address of the CS with the lightest load.
CN201510695847.0A 2015-10-22 2015-10-22 Method and device for realizing always-on service Active CN106612307B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510695847.0A CN106612307B (en) 2015-10-22 2015-10-22 Method and device for realizing always-on service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510695847.0A CN106612307B (en) 2015-10-22 2015-10-22 Method and device for realizing always-on service

Publications (2)

Publication Number Publication Date
CN106612307A true CN106612307A (en) 2017-05-03
CN106612307B CN106612307B (en) 2019-11-15

Family

ID=58612825

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510695847.0A Active CN106612307B (en) 2015-10-22 2015-10-22 Method and device for realizing always-on service

Country Status (1)

Country Link
CN (1) CN106612307B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108900575A (en) * 2018-06-06 2018-11-27 深圳蓝贝科技有限公司 Long connection hierarchical communication method and system based on mobile terminal
CN110831031A (en) * 2018-08-13 2020-02-21 电信科学技术研究院有限公司 A management method and device for continuous online PDU session
CN113162956A (en) * 2020-01-22 2021-07-23 华为技术有限公司 A method, apparatus and network device for establishing a communication connection

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102395119A (en) * 2011-11-15 2012-03-28 华为技术有限公司 A method, system and device for supporting application clients to be permanently online
CN102761864A (en) * 2011-04-29 2012-10-31 中国移动通信集团公司 Data transmission method, system and device
WO2013003684A1 (en) * 2011-06-30 2013-01-03 Amazon Technologies, Inc. Methods and apparatus for remotely updating executing processes
CN103634409A (en) * 2013-12-12 2014-03-12 中国联合网络通信集团有限公司 Method and system for realizing always-online internet application

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102761864A (en) * 2011-04-29 2012-10-31 中国移动通信集团公司 Data transmission method, system and device
WO2013003684A1 (en) * 2011-06-30 2013-01-03 Amazon Technologies, Inc. Methods and apparatus for remotely updating executing processes
CN102395119A (en) * 2011-11-15 2012-03-28 华为技术有限公司 A method, system and device for supporting application clients to be permanently online
CN103634409A (en) * 2013-12-12 2014-03-12 中国联合网络通信集团有限公司 Method and system for realizing always-online internet application

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108900575A (en) * 2018-06-06 2018-11-27 深圳蓝贝科技有限公司 Long connection hierarchical communication method and system based on mobile terminal
CN108900575B (en) * 2018-06-06 2021-07-20 深圳蓝贝科技有限公司 Long connection hierarchical communication method and system based on mobile terminal
CN110831031A (en) * 2018-08-13 2020-02-21 电信科学技术研究院有限公司 A management method and device for continuous online PDU session
CN113727378A (en) * 2018-08-13 2021-11-30 大唐移动通信设备有限公司 Method and device for managing continuous online PDU session
CN113727378B (en) * 2018-08-13 2023-09-12 大唐移动通信设备有限公司 Management method and device for continuous online PDU session
US11778686B2 (en) 2018-08-13 2023-10-03 Datang Mobile Communications Equipment Co., Ltd. Always-on PDU session management method and device
CN113162956A (en) * 2020-01-22 2021-07-23 华为技术有限公司 A method, apparatus and network device for establishing a communication connection

Also Published As

Publication number Publication date
CN106612307B (en) 2019-11-15

Similar Documents

Publication Publication Date Title
KR102247485B1 (en) Internet of Things communication methods, devices and systems
EP1796342B1 (en) A method for transmitting requests
CN104519036B (en) Method and device for sending service request message
EP2803244A2 (en) Methods and apparatus for establishing a tunneled direct link setup (tdls) session between devices in a wireless network
CN103491065A (en) Transparent proxy and transparent proxy realization method
CN102790808A (en) Domain name resolution method and system, client
CN102421201B (en) Method for rapidly establishing dual-stack wireless connection and wireless terminal equipment
WO2015124045A1 (en) Channel establishing method and apparatus
US9455950B1 (en) System and method for implementing traffic optimization for overlay networks
WO2021008591A1 (en) Data transmission method, device, and system
CN102801800A (en) Method and system for performing resource sharing processing among plurality of wireless terminals
CN105873055A (en) Wireless network access authentication method and device
CN103095722A (en) Method for updating network security table and network device and dynamic host configuration protocol (DHCP) server
CN106612307B (en) Method and device for realizing always-on service
CN108124023A (en) Support the method and device of address change
CN106101297B (en) A kind of message answer method and device
CN102629944B (en) Method and device as well as system for network acceleration
US8650313B2 (en) Endpoint discriminator in network transport protocol startup packets
CN110909030B (en) Information processing method and server cluster
CN103179224B (en) Method, client side and server for configuring IP (internet protocol) addresses
WO2016029854A1 (en) Wireless network connection method, device and system
CN106708881B (en) Interactive method and device based on network file system
CN107612831B (en) A method and device for transmitting data message for accessing source station
CN102918878A (en) Method and apparatus for message transmission
CN101510901B (en) Communication method, communication apparatus and system between distributed equipment

Legal Events

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