CN107395767B - Message pushing system and method based on long connection - Google Patents

Message pushing system and method based on long connection Download PDF

Info

Publication number
CN107395767B
CN107395767B CN201710774218.6A CN201710774218A CN107395767B CN 107395767 B CN107395767 B CN 107395767B CN 201710774218 A CN201710774218 A CN 201710774218A CN 107395767 B CN107395767 B CN 107395767B
Authority
CN
China
Prior art keywords
push
server
message
pushing
identification list
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.)
Active
Application number
CN201710774218.6A
Other languages
Chinese (zh)
Other versions
CN107395767A (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.)
BEIJING QIYUAN TECHNOLOGY Co.,Ltd.
Original Assignee
Beijing Qiyuan 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 Beijing Qiyuan Technology Co ltd filed Critical Beijing Qiyuan Technology Co ltd
Priority to CN201710774218.6A priority Critical patent/CN107395767B/en
Publication of CN107395767A publication Critical patent/CN107395767A/en
Application granted granted Critical
Publication of CN107395767B publication Critical patent/CN107395767B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0478Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/062Network architectures or network communication protocols for network security for supporting key management in a packet data network for key distribution, e.g. centrally by trusted party
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities

Abstract

The invention discloses a message pushing system and a message pushing method based on long connection. Wherein the system includes: the system comprises a gateway server, at least one push server, a message center server and a configuration server; the gateway server and at least one push server complete registration in the configuration server in advance; the message push service based on the long connection can ensure that the message is pushed to the client in real time, is also beneficial to realizing accurate push of the message, and overcomes the defect that the message is difficult to ensure in real time because the client needs to actively initiate the message push service based on the short connection in the prior art, the server is greatly burdened when the frequency is too high, and the message cannot be ensured in real time when the frequency is low.

Description

Message pushing system and method based on long connection
Technical Field
The invention relates to the technical field of computers, in particular to a message pushing system and a message pushing method based on long connection.
Background
In the existing message push services, many of them are push services based on short connections, the short connection push services require a client to actively initiate a push request according to business needs, the connection is disconnected after the push is completed, if the client initiation frequency is too high, a large burden is easily caused on a server, but if the initiation frequency is low, the push message cannot be guaranteed to be received by the client in real time, and for some important messages, the time delay caused by the short connection based transmission is fatal.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a long connection based message pushing system and a corresponding long connection based message pushing and method that overcome or at least partially solve the above problems.
According to an aspect of the present invention, there is provided a message push system based on long connection, including: the system comprises a gateway server, at least one push server, a message center server and a configuration server; the gateway server and at least one push server complete registration in the configuration server in advance;
a configuration server adapted to store service information of at least one push server;
the message center server is suitable for managing a message pushing strategy and configuring a pushing task according to the message pushing strategy;
the gateway server is connected with the client terminal in a long way and is suitable for acquiring the service information of the push server from the configuration server after acquiring the user login information provided by at least one client terminal and reporting the user login information provided by at least one client terminal to at least one online push server;
the push server is suitable for recording a user identification list according to the received user login information; and sending the push message to the gateway server according to the user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
According to another aspect of the present invention, there is provided a message pushing method based on a long connection, including:
the gateway server and at least one push server complete registration in the configuration server in advance;
the method comprises the steps that long connection is established between a gateway server and a client, after user login information provided by at least one client is obtained, service information of a push server is obtained from a configuration server, and the user login information provided by at least one client is reported to at least one online push server;
at least one push server records a user identification list according to the received user login information; and sending the push message to the gateway server according to the user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
According to the scheme provided by the invention, the message push service based on the long connection can ensure that the message is pushed to the client in real time, and is beneficial to realizing accurate push of the message, so that the defect that the message push service based on the short connection in the prior art needs to be initiated by the client actively, the server is greatly burdened when the frequency is too high, and the message instantaneity is difficult to ensure when the frequency is low is overcome, and in addition, the time delay of the short connection push is fatal for some important safety information.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic structural diagram of a message pushing system based on a long connection according to a first embodiment of the present invention;
fig. 2 is a schematic structural diagram of a message push system based on a long connection according to a second embodiment of the present invention;
fig. 3 is a block diagram of a message push system based on a long connection according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of a long connection service system according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram illustrating a long connection service system according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram illustrating a long connection service system according to a fifth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a gateway server according to an embodiment of the present invention;
fig. 8 is a flowchart illustrating a message pushing method based on a long connection according to a sixth embodiment of the present invention;
fig. 9 is a flowchart illustrating a long connection service method according to a seventh embodiment of the present invention;
fig. 10 is a flowchart illustrating a long connection service method according to an eighth embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example one
Fig. 1 shows a schematic structural diagram of a message pushing system based on a long connection according to a first embodiment of the present invention. As shown in fig. 1, the system includes: a configuration server 100, a message center server 110, a gateway server 120, and at least one push server 130; wherein the gateway server 120 and the at least one push server 130 are registered in the configuration server 100 in advance.
A configuration server 100 adapted to store service information of at least one push server 130.
The message center server 110 is adapted to manage a message push policy and configure a push task according to the message push policy.
The message pushing strategy can specifically set which product and which service need to push messages, a pushing target, a pushing mode, a pushing task type, creation, starting, stopping and updating of a pushing task, authority management, editing authority, issuing authority, checking number of online people and checking message states.
The gateway server 120, which establishes a long connection with the client, is adapted to obtain the service information of the push server 130 from the configuration server 100 after obtaining the user login information provided by at least one client, and report the user login information provided by at least one client to the at least one online push server 130.
After the client establishes a long connection with the gateway server 120, the gateway server 120 needs to report the obtained user login information (session) of at least one client to the push server 130, specifically, the gateway server 120 obtains the service information of the push server 130 from the configuration server 100, finds the at least one online push server 130 according to the obtained service information, and reports the user login information provided by the at least one client to the at least one online push server 130, where the user login information may include: user identification, login time, login IP, login client, etc.
The at least one push server 130 is adapted to: recording a user identification list according to the received user login information; and sending the push message to the gateway server 120 according to the user identifier list according to the push task issued by the message center server 110, so that the gateway server 120 forwards the push message to the client.
Specifically, after receiving the user login information sent by the gateway server 120, the at least one push server 130 may extract a corresponding user identifier from the user login information, and record the user identifier into a user identifier list, where the user identifier list is used to record the user identifier of the online client, so that the push server 130 selects the corresponding client according to the user identifier list to receive the push message.
The message center server 110 configures a push task according to a message push policy, and issues the push task to at least one push server 130, and the at least one push server 130 receives the push task from the message center server 110, processes the push task to obtain a corresponding push message, and then sends the push message to the gateway server 120 according to the user identifier list, and the gateway server 120 forwards the push message to the client.
According to the message push system based on the long connection provided by the embodiment of the invention, the message push service based on the long connection can ensure that the message is pushed to the client in real time, and is also beneficial to realizing accurate push of the message, so that the defect that the message is difficult to ensure in real time because the message push service based on the short connection in the prior art needs to be actively initiated by the client, the server is greatly burdened if the frequency is too high, and the message cannot be ensured in real time if the frequency is low is overcome, and in addition, for some important safety information, the time delay of the short connection push is fatal.
The configuration server may specifically be a Zookeeper server, which is used as the configuration server to store service information of the push server, such as an IP port number, a service type, and/or an online status, and is only for illustration and not limited in any way. At least one push server registers the service type and port number provided by the push server to a Zookeeper server, and a gateway server obtains the service information of the push server from the Zookeeper server and reports the user login information to the push server, wherein the Zookeeper server generally configures three to five service servers to form a cluster, has disaster tolerance capability, and ensures stable and available service, and the following detailed description is provided by combining with specific embodiments:
fig. 2 is a schematic structural diagram of a message push system based on a long connection according to a second embodiment of the present invention, and fig. 3 is a block diagram of a message push system based on a long connection according to a second embodiment of the present invention. A message push system based on long connection is further described with reference to fig. 2 and 3, and the system includes: a Zookeeper server 200, a gateway server 210, a message center server 220, at least one push server 230, a state center server 240, a distribution device 250, and a statistics device 260; wherein the gateway server 210 and the at least one push server 230 complete the registration in the Zookeeper server 200 in advance.
The Zookeeper server 200 is adapted to store service information of at least one push server 230.
The gateway server 210 establishes a long connection with the client, and is adapted to obtain the service information of the push server 230 from the Zookeeper server 200 after obtaining the user login information provided by at least one client, and report the user login information provided by at least one client to at least one online push server 230.
The message center server 220 is further adapted to: the service information of at least one push server 230 is acquired from the Zookeeper server 200, a push task in a broadcast manner is sent to the online push servers 230, one of the online push servers is set to execute one-stage message push, and all the online push servers execute two-stage message push.
Specifically, the Zookeeper server 200 stores the service information of at least one push server 230, the message center server 220 obtains the service information of at least one push server 230 from the Zookeeper server 200, finds the online push server 230 according to the service information, and sends a push task in a broadcast manner to the online push server 230, where the broadcast process has two stages, the message center server 220 needs to set the push servers 230 that perform one-stage message push and two-stage message push, specifically, one of the online push servers is set to perform one-stage message push, and all the online push servers perform two-stage message push.
After the client establishes a long connection with the gateway server 210 to complete the two-stage login, the gateway server 210 needs to report user login information (session) to the push server 230, specifically, the gateway server 210 acquires service information of the push server 230 from the Zookeeper server 200, finds at least one online push server 230 according to the acquired service information, and reports the user login information provided by at least one client to the at least one online push server 230, where the user login information may include: user identification, login time, login IP, login client, etc.
The at least one push server 230 includes: the push module 231 is adapted to send the push message to the gateway server 210 in a broadcast manner, so that the gateway server 210 forwards the push message to all clients establishing long connections to complete one-stage message pushing; and acquiring an increment user identifier list corresponding to the screened new user login information, and sending the increment user identifier list and the push message to the gateway server 210, so that the gateway server 210 forwards the push message to a corresponding client according to the increment user identifier list to complete two-stage message pushing.
Specifically, the message center server 220 configures a push task according to a message push policy, and issues the push task to the online push server 230, the push server configured to execute a stage of message push processes the received push task to obtain a corresponding push message, the push module 231 sends the push message to the gateway server 210 in a broadcast manner, and the gateway server 210 forwards the push message to all clients establishing a long connection to complete the stage of message push.
During or after the first-stage message pushing process, the gateway server 210 may also report new user login information, and it is known that the push server 230 records a user identifier list according to the received user login information, an incremental user identifier list corresponding to the new user login information needs to be screened for a client corresponding to the new user login information, the push module 231 acquires the incremental user identifier list corresponding to the new user login information obtained by screening, sends the incremental user identifier list and the push message to the gateway server 210, and the gateway server 210 forwards the push message to the corresponding client according to the incremental user identifier list to complete the second-stage message pushing, where the push module 231 needs to execute the second-stage message pushing until the push message expires.
Additionally, the message center server 220 is further adapted to: the method includes the steps of obtaining service information of at least one push server 230 from the Zookeeper server 200, sending a push task in a multicast mode to the online push servers, and setting each online push server to execute one-stage message push and two-stage message push.
Specifically, the Zookeeper server 200 stores the service information of at least one push server 230, and the message center server 220 obtains the service information of at least one push server 230 from the Zookeeper server 200, finds an online push server according to the service information, and sends a push task in a multicast mode to the online push server, where the multicast process has two stages, the message center server 220 needs to set push servers for performing one-stage message pushing and two-stage message pushing, and specifically sets each online push server to perform one-stage message pushing and two-stage message pushing.
The at least one push server 230 includes: the push module 231 is adapted to filter the user identifier list meeting the push conditions according to preset conditions, and send the user identifier list meeting the push conditions and the push message to the gateway server 210, so that the gateway server 210 forwards the push message to the corresponding client according to the user identifier list meeting the push conditions to complete the first-stage message push; and acquiring an increment user identifier list corresponding to the new user login information meeting the push conditions, which is obtained by screening, and sending the increment user identifier list and the push message to the gateway server 210, so that the gateway server 210 forwards the push message to a corresponding client according to the increment user identifier list to complete two-stage message push.
Specifically, the pushing module 231 may filter the list of user identifiers meeting the pushing condition according to a preset condition, for example, filter the list of user identifiers meeting the condition according to an area (IP); or screening a user identifier list meeting the push condition according to the specified user identifier; the user identifier list meeting the pushing condition can be screened according to the specified characteristics, then the user identifier list meeting the pushing condition and the pushing message are sent to the gateway server, and the gateway server 210 forwards the pushing message to the corresponding client according to the user identifier list meeting the pushing condition so as to complete the first-stage message pushing;
during or after the first-stage message pushing process, the gateway server 210 may also report new user login information, and it is known that the push server 230 records a user identifier list according to the received user login information, an incremental user identifier list corresponding to the new user login information needs to be screened for a client corresponding to the new user login information, the push module 231 acquires the incremental user identifier list corresponding to the new user login information obtained by screening, sends the incremental user identifier list and the push message to the gateway server 210, and the gateway server 210 forwards the push message to the corresponding client according to the incremental user identifier list to complete the second-stage message pushing, where the push module 231 needs to execute the second-stage message pushing until the push message expires.
In the embodiment of the present invention, the push server 230 may be expanded in parallel according to the service requirement, and for the gateway server 210 and the message center server 220, the operation of the whole system will not be affected by adding a new push server.
The state center server 240 is adapted to record the pushed push message identification list and the pushed user identification list, and record the successfully pushed user identification list. The state center server 240 may be a Redis server, which may record to which users messages are pushed, which messages are pushed, and which users successfully receive the pushed messages.
In order to prevent frequent access to the status center server, before performing two-stage message pushing, the message pushing system based on long connection may use a distribution device to screen an incremental user identifier list corresponding to new user login information meeting pushing conditions, specifically, the distribution device 250 is adapted to query the status center server 240 to screen an incremental user identifier list corresponding to new user login information meeting pushing conditions, and send the incremental user identifier list to the pushing module, in order to prevent the distribution device from repeatedly accessing the status center server 240, the distribution device 250 further stores query records of the query status center server 240 into its cache, so that when the subsequent incremental user identifier list corresponding to new user login information meeting pushing conditions needs to be screened, its cache may be queried first, if there is no record of a user identifier corresponding to new user login information queried in the cache, the state hub server 240 is queried again and the cache is updated.
After the incremental user identifier list corresponding to the new user login information meeting the push condition is screened out by the distribution device 250, the incremental user identifier list group is sent to at least one push server 230, and the push module 231 in the at least one push server 230 sends the incremental user identifier list and the push message to the gateway server 210, so that the gateway server 210 forwards the push message to the corresponding client according to the incremental user identifier list to complete two-stage message push.
In the embodiment of the present invention, the state center server 240 records the successfully pushed user identifier list and the pushed user identifier list, so that the statistical device 260 can obtain the successfully pushed user identifier list and the pushed user identifier list by querying the state center server 240; and calculating the arrival rate of the push message according to the successfully pushed user identification list and the pushed user identification list, and in addition, performing duplicate elimination processing when calculating the arrival rate of the message so as to avoid that the same client receives the push message for multiple times and the calculation result is inaccurate.
In an embodiment of the present invention, the at least one push server 230 comprises: the caching module 232 is adapted to store a pushed push message identifier list and a pushed user identifier list within a preset time period. In particular, the caching module 232 may store a most recent pushed push message identification list and a pushed user identification list.
In an embodiment of the present invention, the at least one push server 230 further comprises: a configuration module 233 adapted to register the service information of the push server to the configuration server. Specifically, the service information of at least one push server includes: the service type can be specifically a message push service; the online status includes: online and offline.
In an embodiment of the present invention, the at least one push server 230 further comprises: the instruction processing module 234 is adapted to process the push message accordingly according to the message processing instruction sent by the message center server.
Specifically, the message center server 220 may send corresponding message processing instructions, such as a push instruction, a pause instruction, and a cancel instruction, to the push server 230 as needed, and the push server may perform processing such as message pushing, pause pushing, and cancel pushing according to the corresponding message processing instructions. For example, the instruction processing module 234 receives a cancellation message pushing instruction sent by the message center server, searches for a corresponding message, updates the message status to cancelled, stops pushing, and updates the pushed user identifier list.
In the embodiment of the invention, the gateway server comprises a plurality of threads, each push server comprises a connection coroutine, a link is established between one thread of the gateway server and the connection coroutine of the push server, the threads keep a one-to-one corresponding relation with the push server through the link, and the push of the message is finally issued to the client from the connection.
The gateway server distributes the user login information provided by at least one client to each thread in a balanced manner, namely, a certain amount of user login information is stored in each thread, the user login information distributed by each thread is mutually exclusive, and each thread reports the user login information to the corresponding push server based on the link established between the connection coroutines of the at least one push server, so that the user login information reported by each thread is mutually exclusive. Due to load balance among threads, the repetition rate of the user identification recorded among the push servers is low; but also improves the push efficiency, which is also the key for the push server to be able to expand in parallel.
In an embodiment of the present invention, the at least one push server 230 comprises: and the information storage module 235 is adapted to record the user identifier list and the thread identifier according to the received user login information.
In an embodiment of the present invention, the at least one push server 230 is further adapted to: if the client reported by the gateway server is in an offline state, recording the online state of the user identifier corresponding to the client as offline; or if the disconnection of the link between the thread and the gateway server is detected, deleting the thread identifier and the user identifiers corresponding to all user login information reported by the thread.
In order to ensure the accuracy of the push message, the push server needs to obtain the up-down line status of the user, so that after the user completes the two-stage login, the gateway server 210 needs to report the successful user login information to the push server 230, and when the long connection between the client and the gateway server is disconnected, the gateway server 210 deletes the corresponding user login information and also reports the offline status to the push server 230. Although the push servers are distributed, the online and the offline of the same user need to be reported to the same push server, and a time sequence is required, that is, the online state needs to be reported first and then the offline state needs to be reported. The gateway server guarantees the time sequence when sending, can realize the message is merged and sent in batches, each login message has very big expense one by one to send, increase the burden of the gateway server.
In the embodiment of the present invention, the life cycle of the thread of the gateway server is equal to the life cycle of the link, and if the link between the push server and the thread of the gateway server is disconnected, the thread identifier recorded by the push server and the user identifiers corresponding to all the user login information reported by the thread need to be deleted.
In an embodiment of the present invention, the gateway server 210 is further adapted to: if the disconnection of the link between the thread and the coroutine of at least one push server is detected, starting a retry mechanism to establish the link with the push server again, for example, the retry mechanism can be retried for 3 times; if the link fails for 3 times, the user login information stored by the thread is forwarded to other threads.
According to the message push system based on the long connection provided by the embodiment of the invention, the message push service based on the long connection can ensure that the message is pushed to the client in real time, and is favorable for realizing accurate push of the message, so that the defect that the message push service based on the short connection in the prior art needs to be initiated by the client actively, the server is burdened when the frequency is too high, and the message instantaneity is not ensured when the frequency is too low, so that the message instantaneity is difficult to ensure is overcome.
EXAMPLE III
Fig. 4 is a schematic structural diagram illustrating a long connection service system according to a third embodiment of the present invention. As shown in fig. 4, the system includes: a configuration server 400, a gateway server 410 and at least one service server 420; wherein, the gateway server 410 and the at least one service server 420 are registered in the configuration server 400 in advance.
A configuration server 400 adapted to store service information of at least one service server 420.
Specifically, the service information of the at least one service server 420 includes: the system comprises an IP port number, a service type and/or an online state, wherein the service type can specifically comprise user login and key management service, various checking and killing services, message pushing service and the like; the online status includes: online and offline.
The gateway server 410, which establishes a long connection with the client, is adapted to obtain service information of the service server from the configuration server 400, and forward a user login request or a service processing request sent by the client using the long connection to at least one service server 420 on line.
The gateway server 410 is an exit of long connection service and client communication, a TCP long connection is established between the client and the gateway server 410, and the gateway server 410 is used as a bridge for communication between the client and the service server, thereby providing stable and reliable message transparent transmission service.
Specifically, the client sends a user login request or a service processing request to the gateway server 410 by using the long connection established between the client and the gateway server 410, and after receiving the user login request or the service processing request, the gateway server 410 acquires service information of the service server from the configuration server 400, finds at least one online service server according to the acquired service information, and forwards the user login request or the service processing request to at least one online service server 420.
And the at least one service server 420 is suitable for responding to the user login request or the service processing request and forwarding the response information or the service processing result to the client through the gateway server 410.
Specifically, after receiving the user login request or the service processing request, at least one service server 420 responds to the user login request or the service processing request, sends response information or a service processing result to the gateway server 410, and then the gateway server 410 forwards the response information or the service processing result to the client.
Optionally, the gateway server 410 is further adapted to: and sending a service processing request to the at least one service server every fourth preset time to detect the available state of the link between the gateway server and the at least one service server, where the fourth preset time may be set according to actual needs, for example, 0.1 second, and this is merely an example and does not have any limiting effect.
According to the long connection service system provided by the embodiment of the invention, the client sends the user login request or the service processing request based on the long connection established between the client and the gateway server, so that the client can sense the state of the client in real time and forward the user login request or the service processing request in real time, the client can communicate with the corresponding service server quickly, and the safety of the long connection service is improved.
The at least one service server may be a login server, a key server, a cloud killing server, and the configuration server may specifically be a Zookeeper server, which stores service information of the service server as the configuration server, for example, an IP port number, a service type, and/or an online status, and the like, which is only an example and does not have any limiting function here. Each service server registers the service type and port number provided by the service server to the Zookeeper server, and the gateway server obtains the service information of the service server from the Zookeeper server and transfers a specific data packet to the corresponding service server, wherein the Zookeeper server generally configures three to five service servers to form a cluster, has disaster tolerance capability, and ensures stable and available service, and the detailed description is provided below by combining with specific embodiments:
example four
Fig. 5 is a schematic structural diagram of a long connection service system according to a fourth embodiment of the present invention. As shown in fig. 5, the system includes: a Zookeeper server 500, a gateway server 510, and at least one login server 520, at least one key server 530; wherein the gateway server 510, the at least one login server 520, and the at least one key server 530 have previously completed registration in the Zookeeper server 500.
The Zookeeper server 500 is adapted to store service information of at least one login server 520 and service information of at least one key server 530.
The gateway server 510 establishes a long connection with the client, and is adapted to obtain service information of the login server from the Zookeeper server 500, and forward a one-stage user login request carrying encrypted user login information sent by the client through the long connection to at least one online login server 520.
After the long connection is established between the client and the gateway server 510, the client may send a one-stage user login request to the gateway server 510 by using the long connection, where the request carries encrypted user login information, where the request may be encrypted by using an xor encryption and decryption algorithm, and a key used in encryption may be fixed, which is only an example and does not have any limiting function.
After receiving a first-stage user login request carrying encrypted user login information sent by a client, the gateway server 510 obtains service information of the login server from the Zookeeper server 500, finds at least one online login server 520 according to the obtained service information, and forwards the first-stage user login request to the at least one online login server 520.
The at least one login server 520 is adapted to: in response to a one-phase user login request, a one-phase key is forwarded to the client through the gateway server 510.
Specifically, after receiving the one-stage user login request, the at least one login server 520 performs validity verification on the one-stage user login request, and after the verification is passed, the at least one login server 520 sends the one-stage key to the gateway server 510 in response to the one-stage user login request, so as to forward the one-stage key to the client through the gateway server 510, wherein the one-stage key is randomly generated, and the gateway server 510 also records the one-stage key.
The gateway server 510 is further adapted to: acquiring service information of a key server from the Zookeeper server 500, and forwarding a two-stage user login request which is sent by a client and encrypted by a one-stage key to at least one online key server 530;
after receiving the one-stage key forwarded by the gateway server 510, the client encrypts the two-stage user login request by using a NaclEC asymmetric encryption algorithm, performs exclusive-or encryption on the data requested to be encrypted by using the one-stage key returned by the login server, sends the two-stage user login request encrypted by the one-stage key to the gateway server 510, and forwards the two-stage user login request to at least one online key server 530 by the gateway server 510, wherein the purpose is mainly to prevent a public key from being leaked, and improve the complexity of a link replay request.
The at least one key server 530 is adapted to: in response to the two-phase user login request, the two-phase key is forwarded to the client through the gateway server 510, so that the client can encrypt the service data packet by using the two-phase key.
Specifically, after receiving the two-stage user login request, at least one key server 530 performs xor decryption on the two-stage user login request by using the one-stage key, decrypts the data by using the NacleC asymmetric encryption algorithm after the decryption is successful, verifies the validity of the two-stage user login request, and sends the two-stage key to the gateway server 510 after the verification is passed, so that the two-stage key is forwarded to the client by the gateway server 510, the subsequent client can encrypt the service data packet by using the two-stage key, and by performing the two-stage login and encrypting the login request, the security of the communication protocol can be ensured, and malicious attacks against protocol cracking and protocol cracking can be prevented.
To prevent slow links, the gateway server 510 strictly defines the request time, in particular the gateway server 510 is further adapted to: after the long connection is established with the client, whether a one-stage user login request sent by the client is received or not is judged within a second preset time, and if not, the established long connection with the client is disconnected, so that malicious connection and TCP SYN-based attack are effectively prevented, and handle waste is prevented, wherein the second preset time can be set according to actual needs, for example, 0.01 second, which is only an example and does not have any limiting effect.
Furthermore, the gateway server 510 is further adapted to: after the first-stage key is forwarded to the client, it is determined whether a two-stage user login request sent by the client is received within a third preset time, and if not, the long connection established with the client is disconnected, so as to prevent handle waste, where the third preset time may be set according to actual needs, for example, 0.01 second, which is merely an example and does not have any limiting function.
In addition, aiming at a single client, the number of the established connections and the number of the requests per second are limited, and if the protocol is cracked, the access service can be effectively prevented from being paralyzed due to the overload of the requests.
According to the long connection service system provided by the embodiment of the invention, the client sends the two-stage user login request based on the long connection established between the client and the gateway server, and the login server and the key server perform two-stage login verification, so that the safety of the long connection service is improved.
Example five
Fig. 6 is a schematic structural diagram illustrating a long connection service system according to a fifth embodiment of the present invention. As shown in fig. 6, the system includes: a Zookeeper server 600, a gateway server 610, and at least one cloud killer server 620; wherein, the gateway server 610 and the at least one cloud killer server 620 complete the registration in the Zookeeper server 600 in advance.
And the Zookeeper server 600 is suitable for storing the service information of at least one cloud searching and killing server 620.
The gateway server 610 establishes a long connection with the client, and is adapted to obtain service information of the cloud killing server from the Zookeeper server 600, and forward a service processing request carrying a service data packet encrypted by a two-stage key, which is sent by the client through the long connection, to at least one online cloud killing server 620.
Specifically, after a long connection is established between the client and the gateway server 610, the client may send a service processing request to the gateway server 610 by using the long connection, where the request carries a service data packet encrypted by a two-stage key, and after receiving the service processing request, the gateway server 610 obtains service information of the cloud killing server from the Zookeeper server 600, finds at least one online cloud killing server 620 according to the obtained service information, and forwards the cloud killing request to the at least one online cloud killing server 620, where the service processing request may be a cloud killing request.
The at least one cloud killing server 620 is adapted to: in response to the service processing request, the cloud searching and killing result is obtained by interacting with the cloud rule platform and the storage system, and the cloud searching and killing result is forwarded to the client through the gateway server 610.
The at least one cloud searching and killing server 620 may provide various searching and killing services, support http, tcp, udp and other interfaces, and may adopt a middle interface layer (safe/triple) to implement service function plug-in management, so that the secure service may be quickly accessed to the long connection service without modifying (or with little modification of some statistical information).
Specifically, after receiving the cloud searching and killing request, the at least one cloud searching and killing server 620 interacts with the cloud rule platform and the KV storage system to obtain a service processing result, completes a cloud searching and killing request, and finally returns the service processing result to the client through the gateway server.
In order to prevent the cloud from checking and killing the influence of the server upgrade, restart, and the like on the request failure, a function of a retry mechanism is added to the gateway server, and specifically, the gateway server is further adapted to: if the service processing result returned by the at least one cloud searching and killing server is not received within the first preset time, starting a retry mechanism to send the service processing request to the at least one online cloud searching and killing server again, wherein the retry times of the gateway server can be preset, for example, 3 times, and if the retry times are all 3 times failed, it can be determined that the link between the gateway server and the cloud searching and killing server is disconnected.
In an optional embodiment of the present invention, the at least one service server may comprise: in the intrusion prevention server, at this time, the service processing request may be an active prevention request, and a specific implementation process is similar to that in the embodiment shown in fig. 3, and is not described here again.
According to the long connection service system provided by the embodiment of the invention, the client sends the service processing request based on the long connection established between the client and the gateway server, and can realize real-time forwarding of the service request, so that the client can quickly communicate with the cloud searching and killing server, and realize real-time sensing of the client state.
Specifically, referring to the gateway server, fig. 7 is a schematic structural diagram of the gateway server according to an embodiment of the present invention, and as shown in fig. 7, the gateway server includes: a thread monitoring module 701 adapted to obtain service information of at least one service server from a configuration server; and establishing long connection with the client, and transferring the long connection to the working thread module.
A worker thread module 702 adapted to forward a user login request or a service processing request sent by a client using a long connection to at least one online service server; and reporting the user login information provided by at least one client to at least one online push server.
Considering the problem that the gateway server may crash during operation, the gateway server adopts a mode of separating the monitoring thread module and the working thread module, the monitoring thread module does not process services and is only responsible for monitoring the operation state of the working thread, and once the working thread crashes is found, the working thread is immediately created again. In addition, when monitoring that the long connection service is unavailable, the monitoring thread module 701 sends a short message to alarm operation and maintenance and development personnel for manual intervention.
In addition, the worker thread module 702 is further adapted to: recording error information, user login requests or service processing requests of the gateway server during operation into a log, specifically, when the gateway server is likely to encounter errors during operation, a working thread module 702 records the internal error information into the log, and if a fatal error occurs, the working thread module also generates a coredump file and stores the coredump file into an appointed directory, so that developers can trace the errors and debug conveniently; checking the running state of the gateway server through a preset interface; detecting the heartbeat of the client, and disconnecting the long connection with the client when the heartbeat is overtime; and verifying whether the user login information is valid.
EXAMPLE six
Fig. 8 is a flowchart illustrating a message pushing method based on a long connection according to a sixth embodiment of the present invention. As shown in fig. 8, the method comprises the steps of:
step S800, the gateway server and the at least one push server complete registration in the configuration server in advance.
Step S801, a long connection is established between the gateway server and the client, after obtaining the user login information provided by at least one client, the gateway server obtains the service information of the push server from the configuration server, and reports the user login information provided by at least one client to at least one online push server.
Step S802, at least one push server records a user identification list according to the received user login information; and sending the push message to the gateway server according to the user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
According to the message pushing method based on the long connection provided by the embodiment of the invention, the message pushing service based on the long connection can ensure that the message is pushed to the client in real time, and is also beneficial to realizing accurate pushing of the message, so that the defect that the message is difficult to ensure in real time because the message pushing service based on the short connection in the prior art needs to be actively initiated by the client, the server is greatly burdened if the frequency is too high, and the message cannot be ensured in real time if the frequency is low is overcome, and in addition, for some important safety information, the time delay of the short connection pushing is fatal.
EXAMPLE seven
Fig. 9 is a flowchart illustrating a long connection service method according to a seventh embodiment of the present invention. As shown in fig. 9, the method includes the steps of:
step S900, the gateway server and at least one service server complete registration in the configuration server in advance.
Step S901, a long connection is established between a gateway server and a client, service information of a service server is obtained from a configuration server, and a user login request or a service processing request sent by the client using the long connection is forwarded to at least one online service server.
Step S902, at least one service server responds to the user login request or the service processing request, and forwards the response information or the service processing result to the client through the gateway server.
According to the long connection service method provided by the embodiment of the invention, the client sends the user login request or the service processing request based on the long connection established between the client and the gateway server, so that the client can sense the state of the client in real time and forward the user login request or the service processing request in real time, the client can communicate with the corresponding service server quickly, and the safety of the long connection service is improved.
Example eight
Fig. 10 is a flowchart illustrating a long connection service method according to an eighth embodiment of the present invention. The gateway server and the at least one service server complete the registration in the configuration server in advance before the following steps are performed. After registration, the following steps are performed:
step S1000, a long connection is established between the gateway server and the client, the service information of at least one login server is obtained from the configuration server, and a one-stage user login request which is sent by the client and carries the encrypted user login information is forwarded to the at least one login server on line.
Step S1001, at least one login server responds to a first-stage user login request and forwards a first-stage key to a client through a gateway server.
Step S1002, the gateway server obtains the service information of at least one key server from the configuration server, and forwards the two-stage user login request which is sent by the client and encrypted by the one-stage key to the at least one key server on line.
Step S1003, in response to the two-phase user login request, at least one key server forwards the two-phase key to the client through the gateway server, so that the client encrypts the service data packet by using the two-phase key.
Step S1004, the gateway server obtains the service information of at least one cloud searching and killing server from the configuration server, and forwards the service processing request carrying the service data packet encrypted by the two-stage key sent by the client to the at least one online cloud searching and killing server.
Step S1005, in response to the service processing request, the at least one cloud searching and killing server interacts with the cloud rule platform and the storage method to obtain a service processing result, and forwards the service processing result to the client through the gateway server.
Step S1006, the gateway server reports the user login information provided by at least one client to at least one online push server.
Step 1007, at least one push server records a user identifier list according to the received user login information; and sending the push message to the gateway server according to the user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
Optionally, the method further comprises: the method comprises the steps that a gateway server detects whether a service processing result returned by at least one cloud searching and killing server is received within first preset time;
and if the business processing result returned by the at least one cloud searching and killing server is not received within the first preset time, starting a retry mechanism to send the business processing request to the at least one online cloud searching and killing server again.
Optionally, the method further comprises: the message center server acquires the service information of at least one push server from the configuration server, sends a push task in a broadcast mode to the online push servers, sets one of the online push servers to execute one-stage message push, and executes two-stage message push by all the online push servers.
Optionally, the sending, by the at least one push server, the push message to the gateway server according to the user identifier list according to the push task issued by the message center server, so that the gateway server forwards the push message to the client, further includes:
at least one push server sends push messages to a gateway server in a broadcast mode so that the gateway server can forward the push messages to all clients establishing long connection to complete one-stage message pushing; and
and acquiring an increment user identification list corresponding to the screened new user login information, and sending the increment user identification list and the push message to a gateway server so that the gateway server forwards the push message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
Optionally, the method further comprises: the message center server acquires the service information of at least one push server from the configuration server, sends a push task in a multicast mode to the online push servers, sets each online push server to execute one-stage message push, and executes two-stage message push by all the online push servers.
Optionally, the sending, by the at least one push server, the push message to the gateway server according to the user identifier list according to the push task issued by the message center server, so that the gateway server forwards the push message to the client, further includes:
at least one push server screens a user identification list meeting the push conditions according to preset conditions, and sends the user identification list meeting the push conditions and push messages to a gateway server, so that the gateway server forwards the push messages to corresponding clients according to the user identification list meeting the push conditions to finish one-stage message push; and
and acquiring an increment user identification list corresponding to the new user login information which is obtained by screening and accords with the pushing condition, and sending the increment user identification list and the pushing message to a gateway server so that the gateway server forwards the pushing message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
Optionally, the method further comprises: and storing the pushed push message identification list and the pushed user identification list to a state center server.
Optionally, the method further comprises: after the long connection is established with the client, the gateway server judges whether a first-stage user login request sent by the client is received within a second preset time, and if not, the long connection established with the client is disconnected.
Optionally, the method further comprises: after the first-stage secret key is forwarded to the client, the gateway server judges whether a two-stage user login request sent by the client is received within a third preset time, and if not, the long connection established between the gateway server and the client is disconnected.
Optionally, the method further comprises: and the gateway server sends a service processing request to the at least one service server at intervals of a fourth preset time so as to detect the available state of the link between the gateway server and the at least one service server.
Optionally, the gateway server comprises: monitoring a thread and a working thread;
the monitoring thread acquires the service information of at least one service server from the configuration server;
the working thread forwards a user login request or a service processing request sent by a client through long connection to at least one online service server; and reporting the user login information provided by at least one client to at least one online push server.
Optionally, the method further comprises: and establishing long connection between the monitoring thread and the client, and transferring the long connection to the working thread.
Optionally, the method further comprises: and the working thread records error information, user login requests or service processing requests of the gateway server during operation into a log.
Optionally, the method further comprises: and the working thread checks the running state of the gateway server through a preset interface.
Optionally, the service information includes: IP port number, service type, and/or presence status.
According to the long connection service method provided by the embodiment of the invention, the client sends the two-stage user login request based on the long connection established between the client and the gateway server, and the login server and the key server carry out the two-stage login verification, so that the safety of the long connection service is improved; the client sends the service processing request based on the long connection established between the client and the gateway server, and can realize real-time forwarding of the service request, so that the client can quickly communicate with the cloud searching and killing server, the client can realize real-time sensing of the client state, and when viruses (such as Lessoer viruses) which have great harm influence appear, the client can immediately obtain a protection means through the long connection service under the condition of no upgrading, so that the harm caused by the viruses is reduced; the message push service based on the long connection can ensure that the message is pushed to the client in real time, is also beneficial to realizing accurate push of the message, and overcomes the defect that the message is difficult to ensure in real time because the client needs to actively initiate the message push service based on the short connection in the prior art, the server is greatly burdened when the frequency is too high, and the message cannot be ensured in real time when the frequency is low.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in a long connection based message push device according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (30)

1. A message push system based on long connections, comprising: the system comprises a gateway server, at least one push server, a message center server and a configuration server; the gateway server and the at least one push server complete registration in the configuration server in advance;
a configuration server adapted to store service information of the at least one push server;
the message center server is suitable for managing a message pushing strategy and configuring a pushing task according to the message pushing strategy;
the gateway server is connected with the client terminal in a long way and is suitable for acquiring the service information of the push server from the configuration server after acquiring the user login information provided by at least one client terminal and reporting the user login information provided by at least one client terminal to at least one online push server;
the push server is suitable for recording a user identification list according to the received user login information; and sending the push message to a gateway server according to a user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
2. The message push system of claim 1, wherein the message center server is further adapted to: the method comprises the steps of obtaining service information of at least one push server from a configuration server, sending a push task in a broadcast mode to the online push servers, setting one of the online push servers to execute one-stage message push, and executing two-stage message push by all the online push servers.
3. The message push system of claim 2, wherein the at least one push server comprises: the push module is suitable for sending the push message to the gateway server in a broadcast mode so that the gateway server can forward the push message to all the clients establishing long connection to complete one-stage message push; and acquiring an increment user identification list corresponding to the screened new user login information, and sending the increment user identification list and the push message to a gateway server, so that the gateway server forwards the push message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
4. The message push system of claim 1, wherein the message center server is further adapted to: the method comprises the steps of obtaining service information of at least one push server from a configuration server, sending push tasks in a multicast mode to the online push servers, and setting each online push server to execute one-stage message push and two-stage message push.
5. The message push system of claim 4, wherein the at least one push server comprises: the push module is suitable for screening a user identification list meeting the push conditions according to preset conditions, and sending the user identification list meeting the push conditions and the push message to the gateway server so that the gateway server can forward the push message to a corresponding client according to the user identification list meeting the push conditions to finish the one-stage message push; and acquiring an increment user identification list corresponding to the new user login information which is obtained by screening and accords with the pushing condition, and sending the increment user identification list and the pushing message to a gateway server so that the gateway server can forward the pushing message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
6. The message push system according to claim 3 or 5, wherein the system further comprises: and the state center server is suitable for recording the pushed push message identification list and the pushed user identification list and recording the successfully pushed user identification list.
7. The message push system of claim 6, wherein the system comprises: the distribution device is suitable for querying the state central server to screen out an increment user identification list corresponding to the new user login information meeting the pushing condition, sends the increment user identification list to the pushing module and stores the query record;
the push module is further adapted to: and sending the incremental user identifier list and the push message to a gateway server so that the gateway server forwards the push message to a corresponding client according to the incremental user identifier list to complete two-stage message push.
8. The message push system of claim 6, further comprising: the statistical device is suitable for inquiring the state center server to obtain a user identification list which is successfully pushed and a user identification list which is pushed;
and calculating the arrival rate of the push message according to the successfully pushed user identification list and the pushed user identification list.
9. The message push system of claim 1, wherein the at least one push server comprises: and the cache module is suitable for storing the pushed push message identification list and the pushed user identification list in a preset time period.
10. The message push system of claim 1, wherein the at least one push server further comprises: and the configuration module is suitable for registering the service information of the push server to the configuration server.
11. The message push system of claim 1, wherein the at least one push server further comprises: and the instruction processing module is suitable for correspondingly processing the push message according to the message processing instruction sent by the message center server.
12. The message pushing system according to claim 1, wherein the gateway server includes a plurality of threads, each push server includes a connection coroutine, and a link is established between one thread of the gateway server and the connection coroutine of the push server;
the gateway server distributes the user login information provided by at least one client to each thread in a balanced manner, and each thread reports the user login information to at least one online push server based on a link established between the connection coroutines of the at least one push server, wherein the user login information reported by each thread is mutually exclusive.
13. The message push system of claim 12, wherein the at least one push server comprises: and the information storage module is suitable for recording the user identification list and the thread identification according to the received user login information.
14. The message push system of claim 13, wherein the at least one push server is further adapted to: if the client reported by the gateway server is in an offline state, recording the online state of the user identifier corresponding to the client as offline; or
And if the disconnection of the link between the thread and the gateway server is detected, deleting the thread identification and the user identifications corresponding to all user login information reported by the thread.
15. The message pushing system according to claim 13 or 14, wherein the gateway server is further adapted to: if the disconnection of the link between the thread and the coroutine of at least one push server is detected, starting a retry mechanism to establish the link with the push server again;
and if the link fails, forwarding the user login information stored in the thread to other threads.
16. A message pushing method based on long connection includes:
the gateway server and at least one push server complete registration in the configuration server in advance;
the method comprises the steps that long connection is established between a gateway server and a client, after user login information provided by at least one client is obtained, service information of a push server is obtained from a configuration server, and the user login information provided by at least one client is reported to at least one online push server;
at least one push server records a user identification list according to the received user login information; and sending the push message to a gateway server according to a user identification list according to the push task issued by the message center server, so that the gateway server can forward the push message to the client.
17. The message pushing method according to claim 16, wherein the method further comprises: the message center server acquires the service information of at least one push server from the configuration server, sends a push task in a broadcast mode to the online push servers, sets one of the online push servers to execute one-stage message push, and executes two-stage message push by all the online push servers.
18. The message pushing method according to claim 17, wherein the at least one pushing server sends the pushing message to the gateway server according to the user identifier list according to the pushing task issued by the message center server, so that the gateway server forwards the pushing message to the client, further comprises:
the at least one push server sends the push message to a gateway server in a broadcast mode so that the gateway server can forward the push message to all clients establishing long connection to complete one-stage message push; and acquiring an increment user identification list corresponding to the screened new user login information, and sending the increment user identification list and the push message to a gateway server, so that the gateway server forwards the push message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
19. The message pushing method according to claim 16, wherein the method further comprises: the message center server acquires the service information of at least one push server from the configuration server, sends a push task in a multicast mode to the online push servers, and sets each online push server to execute one-stage message push and two-stage message push.
20. The message pushing method according to claim 19, wherein the at least one pushing server sends the pushing message to the gateway server according to the user identifier list according to the pushing task issued by the message center server, so that the gateway server forwards the pushing message to the client, further comprises:
the at least one push server screens a user identification list meeting the push conditions according to preset conditions, and sends the user identification list meeting the push conditions and the push message to the gateway server, so that the gateway server forwards the push message to a corresponding client according to the user identification list meeting the push conditions to complete the first-stage message push; and acquiring an increment user identification list corresponding to the new user login information which is obtained by screening and accords with the pushing condition, and sending the increment user identification list and the pushing message to a gateway server so that the gateway server can forward the pushing message to a corresponding client according to the increment user identification list to complete two-stage message pushing.
21. The message pushing method according to claim 18 or 20, wherein the method further comprises: and recording the pushed push message identification list, the pushed user identification list and the successfully pushed user identification list to the state center server.
22. The message pushing method according to claim 21, wherein the method comprises: the distribution device queries the state central server to screen out an increment user identification list corresponding to new user login information meeting the pushing conditions, sends the increment user identification list to at least one pushing server, and stores the query records;
and the at least one pushing server sends the incremental user identifier list and the pushing message to the gateway server so that the gateway server forwards the pushing message to the corresponding client according to the incremental user identifier list to complete two-stage message pushing.
23. The message pushing method according to claim 21, the method further comprising: the statistical device queries the state center server to obtain a user identification list which is successfully pushed and a user identification list which is pushed;
and calculating the arrival rate of the push message according to the successfully pushed user identification list and the pushed user identification list.
24. The message pushing method according to claim 16, wherein the method further comprises: the at least one push server stores a pushed push message identification list and a pushed user identification list in a preset time period.
25. The message pushing method according to claim 16, wherein the method further comprises: the at least one push server registers the service information with the configuration server.
26. The message pushing method according to claim 16, wherein the method further comprises: and the at least one push server correspondingly processes the push message according to the message processing instruction sent by the message center server.
27. The message pushing method according to claim 16, wherein the gateway server includes a plurality of threads, each push server includes a connection coroutine, and a link is established between one thread of the gateway server and the connection coroutine of the push server;
the method further comprises the following steps: the gateway server distributes the user login information provided by at least one client to each thread in a balanced manner, and each thread reports the user login information to at least one online push server based on a link established between the connection coroutines of the at least one push server, wherein the user login information reported by each thread is mutually exclusive.
28. The message pushing method of claim 27, wherein the method further comprises: and the at least one push server records a user identification list and a thread identification according to the received user login information.
29. The message pushing method according to claim 28, wherein the method further comprises: if the client reported by the gateway server is in an offline state, the online state of the user identifier corresponding to the client is recorded as offline by the at least one push server; or
And if the disconnection of the link between the thread and the gateway server is detected, deleting the thread identifier and the user identifiers corresponding to all the user login information reported by the thread by the at least one push server.
30. The message pushing method according to claim 28 or 29, wherein the method further comprises: if the disconnection of the link between the thread and the coroutine of at least one push server is detected, the gateway server starts a retry mechanism to establish the link with the push server again; and if the link fails, forwarding the user login information stored in the thread to other threads.
CN201710774218.6A 2017-08-31 2017-08-31 Message pushing system and method based on long connection Active CN107395767B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710774218.6A CN107395767B (en) 2017-08-31 2017-08-31 Message pushing system and method based on long connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710774218.6A CN107395767B (en) 2017-08-31 2017-08-31 Message pushing system and method based on long connection

Publications (2)

Publication Number Publication Date
CN107395767A CN107395767A (en) 2017-11-24
CN107395767B true CN107395767B (en) 2021-02-05

Family

ID=60347472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710774218.6A Active CN107395767B (en) 2017-08-31 2017-08-31 Message pushing system and method based on long connection

Country Status (1)

Country Link
CN (1) CN107395767B (en)

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109922101B (en) * 2017-12-12 2023-08-15 三六零科技集团有限公司 Method, device and server for realizing specific service in mobile terminal
CN108093060A (en) * 2017-12-26 2018-05-29 陈占辉 A kind of method for pushing of Intelligent housing background system message
CN108093076A (en) * 2017-12-29 2018-05-29 北京奇虎科技有限公司 Information push method and device
CN108234631B (en) * 2017-12-29 2021-06-15 北京奇虎科技有限公司 Message pushing platform and message pushing method
CN108243112B (en) * 2018-01-11 2022-07-19 杭州网易智企科技有限公司 Chat group network flow control method and device, storage medium and computing equipment
CN108322521B (en) * 2018-01-17 2020-10-16 腾讯科技(深圳)有限公司 Message content pushing method, device, system, computer equipment and storage medium
CN108769111B (en) * 2018-04-17 2020-01-24 平安科技(深圳)有限公司 Server connection method, computer readable storage medium and terminal device
CN108390950A (en) * 2018-05-28 2018-08-10 中国建设银行股份有限公司 A kind of information push method, device and equipment
CN110753070A (en) * 2018-07-23 2020-02-04 北京国双科技有限公司 Data communication method, client, server and data communication system
CN110166576B (en) * 2019-06-28 2022-07-01 飞天诚信科技股份有限公司 Method and system for realizing message complementary pushing of cloud sound box
CN110545327B (en) * 2019-09-20 2022-04-29 北京达佳互联信息技术有限公司 Information pushing method and system
CN111131443B (en) * 2019-12-23 2023-06-30 中国平安财产保险股份有限公司 Task pushing method and system
CN113238808A (en) * 2020-01-22 2021-08-10 北京沃东天骏信息技术有限公司 Message pushing method and device
CN111866095A (en) * 2020-07-01 2020-10-30 合肥森亿智能科技有限公司 Unified pushing platform, method and terminal based on private cloud
CN112134783A (en) * 2020-08-11 2020-12-25 广州市贺氏办公设备有限公司 Instant messaging system, method, device and medium based on user intimacy
CN112883261A (en) * 2021-01-28 2021-06-01 北京百度网讯科技有限公司 Configuration data pushing method and device, electronic equipment and medium
CN115134404B (en) * 2021-03-22 2024-01-30 花瓣云科技有限公司 Method for managing push connection and electronic equipment
CN113127236A (en) * 2021-05-10 2021-07-16 广州欢网科技有限责任公司 Message pushing method and device and server
CN114051037A (en) * 2021-11-02 2022-02-15 珠海读书郎软件科技有限公司 Method for managing and distributing push message
CN114095465A (en) * 2021-11-17 2022-02-25 北京同城必应科技有限公司 Method for realizing efficient IM message time sequence guarantee mechanism under distributed environment
CN115296822B (en) * 2022-09-28 2022-12-20 飞天诚信科技股份有限公司 Method and system for realizing service processing

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070014350A (en) * 2005-07-28 2007-02-01 에스케이 텔레콤주식회사 Authentification method in the push proxy gateway and the contents provider server
CN102209302A (en) * 2011-07-07 2011-10-05 深圳市金立通信设备有限公司 System and method for realizing information push of mobile terminal
CN103051715A (en) * 2012-12-24 2013-04-17 东软熙康健康科技有限公司 Method for releasing notice to terminal, relevant device and system
CN105099882A (en) * 2015-07-09 2015-11-25 杭州电子科技大学 MQTT-based cloud pushing method and system
CN105141452A (en) * 2015-08-07 2015-12-09 北京思特奇信息技术股份有限公司 High-performance service system and method based on CXF
CN105407180A (en) * 2015-12-29 2016-03-16 曙光信息产业(北京)有限公司 Server message pushing method and device
CN106385435A (en) * 2016-08-30 2017-02-08 乐视控股(北京)有限公司 Service treatment method and system of service system
CN107086954A (en) * 2017-05-23 2017-08-22 北京奇虎科技有限公司 Information push method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070014350A (en) * 2005-07-28 2007-02-01 에스케이 텔레콤주식회사 Authentification method in the push proxy gateway and the contents provider server
CN102209302A (en) * 2011-07-07 2011-10-05 深圳市金立通信设备有限公司 System and method for realizing information push of mobile terminal
CN103051715A (en) * 2012-12-24 2013-04-17 东软熙康健康科技有限公司 Method for releasing notice to terminal, relevant device and system
CN105099882A (en) * 2015-07-09 2015-11-25 杭州电子科技大学 MQTT-based cloud pushing method and system
CN105141452A (en) * 2015-08-07 2015-12-09 北京思特奇信息技术股份有限公司 High-performance service system and method based on CXF
CN105407180A (en) * 2015-12-29 2016-03-16 曙光信息产业(北京)有限公司 Server message pushing method and device
CN106385435A (en) * 2016-08-30 2017-02-08 乐视控股(北京)有限公司 Service treatment method and system of service system
CN107086954A (en) * 2017-05-23 2017-08-22 北京奇虎科技有限公司 Information push method and device

Also Published As

Publication number Publication date
CN107395767A (en) 2017-11-24

Similar Documents

Publication Publication Date Title
CN107395767B (en) Message pushing system and method based on long connection
CN107580046B (en) Long connection service system and method
US10091228B2 (en) Secured event monitoring leveraging blockchain
US10728216B2 (en) Web application security architecture
US11223639B2 (en) Endpoint network traffic analysis
CN106911648B (en) Environment isolation method and equipment
CN107347047B (en) Attack protection method and device
CN114787781A (en) System and method for enabling high availability managed failover services
US11741075B2 (en) Methods and system of tracking transactions for distributed ledger
CN112261172B (en) Service addressing access method, device, system, equipment and medium
CN110213263B (en) Identity authentication method, equipment and storage medium based on alliance block chain
CN111353151B (en) Vulnerability detection method and device for network application
Zhang et al. DBFT: A Byzantine fault tolerance protocol with graceful performance degradation
CN111698126A (en) Information monitoring method, system and computer readable storage medium
CN117131493A (en) Authority management system construction method, device, equipment and storage medium
US11765058B2 (en) Extensible, secure and efficient monitoring and diagnostic pipeline for hybrid cloud architecture
US20230224337A1 (en) Methods, System and Communication Devices Related to Lawful interception
US20200287847A1 (en) System and control method
CN112363887A (en) Distributed application monitoring method and device and storage medium
CN107124390B (en) Security defense and implementation method, device and system of computing equipment
CN117632922B (en) Service operation platform based on high concurrency task processing and data processing method
CN116029729B (en) Cross-link method and system based on dynamic access application link management contract mode
US20230198845A1 (en) Systems and methods of configuring monitoring operations for a cluster of servers
TWI717457B (en) Environmental isolation method and equipment
CN117632922A (en) Service operation platform based on high concurrency task processing and data processing method

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
TA01 Transfer of patent application right

Effective date of registration: 20201210

Address after: 1762, floor 17, 15 / F, building 3, 10 Jiuxianqiao Road, Chaoyang District, Beijing 100020

Applicant after: BEIJING QIYUAN TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Applicant before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant