CN113157466A - Message pushing method, device, system, electronic equipment and storage medium - Google Patents

Message pushing method, device, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113157466A
CN113157466A CN202110460984.1A CN202110460984A CN113157466A CN 113157466 A CN113157466 A CN 113157466A CN 202110460984 A CN202110460984 A CN 202110460984A CN 113157466 A CN113157466 A CN 113157466A
Authority
CN
China
Prior art keywords
message
user information
target user
server
redis
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110460984.1A
Other languages
Chinese (zh)
Inventor
李潘林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Krypton Information Technology Co ltd
Original Assignee
Shanghai Krypton Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Krypton Information Technology Co ltd filed Critical Shanghai Krypton Information Technology Co ltd
Priority to CN202110460984.1A priority Critical patent/CN113157466A/en
Publication of CN113157466A publication Critical patent/CN113157466A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Abstract

The application discloses a message pushing method, a device, a system, an electronic device and a storage medium, wherein the method comprises the following steps: each server in the websocket service cluster subscribes a user message theme of the redis message middleware; when a service party issues a specified message to a redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware; each server in the websocket service cluster detects whether target user information is stored locally; the target user information is user information corresponding to the specified message; and the server storing the target user information pushes the received specified message to the client corresponding to the target user information. The websocket service cluster in the method can directly receive the specified message broadcasted by the redis message middleware to send the specified message to the client, and the implementation process is simple, efficient, convenient and quick.

Description

Message pushing method, device, system, electronic equipment and storage medium
Technical Field
The present application relates to the field of websocket message pushing technologies, and in particular, to a message pushing method, apparatus, system, electronic device, and storage medium.
Background
At present, in a traditional websocket real-time message push service, under websocket server cluster environment deployment, the position of a node server where a user object is specifically stored cannot be accurately identified, so that message push cannot be effectively delivered to a client. In the related technology, when a service party randomly sends a message to a certain server, the server acquires information of other servers in a mode of traversing zookeeper middleware, the zookeeper middleware registers information of a server cluster, and then the server sends the received message to other servers, so that the purpose of effectively sending the message to a client is achieved. In this way, zookeeper middleware needs to be accessed first, and then messages are sent to the servers one by one, so that the process is complicated and the efficiency is low.
Disclosure of Invention
The websocket service cluster can directly receive the specified message broadcasted by the redis message middleware and then send the specified message to the client corresponding to the target user information, the implementation process is simple and efficient, convenience and rapidness are achieved, and the message can be guaranteed to be effectively sent to the client. The specific scheme is as follows:
in a first aspect, the present application discloses a message pushing method, including:
each server in the websocket service cluster subscribes a user message theme of the redis message middleware;
when a service party issues a specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware;
each server in the websocket service cluster detects whether target user information is stored locally; the target user information is user information corresponding to the specified message;
and the server storing the target user information pushes the received appointed message to a client corresponding to the target user information.
Optionally, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, the method further includes:
if the server storing the target user information detects that the user state in the target user information is offline, the designated message is stored in the Mysql database, and when the user state in the target user information is online, the designated message is sent to the client corresponding to the target user information.
Optionally, when the service party issues a specific message to the redis message middleware, each server in the websocket service cluster receives the specific message broadcasted by the redis message middleware, including:
and when the service party calls a message distribution service to send the issued specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware.
Optionally, the pushing, by the server storing the target user information, the received specified message to the client corresponding to the target user information includes:
and when the clients registered with the target user information comprise a plurality of clients, the server storing the target user information pushes the received appointed message to each client registered with the target user information.
Optionally, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, the method further includes:
the server storing the target user information receives a CMD connection request of a client corresponding to the target user information;
analyzing the CMD connection request to obtain the target user information;
performing security verification and authentication on the target user information;
and if the verification is passed, executing the step that the server storing the target user information pushes the received appointed message to a client corresponding to the target user information.
Optionally, the method further includes:
and after receiving a heartbeat detection request of the client corresponding to the target user information, sending a response signal to the client to inform the client that the current state of the websocket service cluster is available.
In a second aspect, the present application discloses a message pushing apparatus, which is applied to a websocket service cluster, and includes:
the subscription module is used for subscribing the user message theme of the redis message middleware by each server in the websocket service cluster;
the receiving module is used for receiving the specified message broadcasted by the redis message middleware by each server in the websocket service cluster when a service party publishes the specified message to the redis message middleware;
the determining module is used for detecting whether target user information is stored locally in each server in the websocket service cluster; the target user information is user information corresponding to the specified message;
and the pushing module is used for pushing the received appointed message to a client corresponding to the target user information by the server in which the target user information is stored.
In a third aspect, the present application discloses a message pushing system, including:
the service side is used for issuing a specified message to the redis message middleware so that the redis message middleware broadcasts the specified message to each server in the websocket service cluster;
each server in the websocket service cluster, configured to perform the steps of the message pushing method according to any one of claims 1 to 6;
and the client is used for receiving the specified message sent by the server in which the target user information is stored in the websocket service cluster.
In a fourth aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the message pushing method when executing the computer program.
In a fifth aspect, the present application discloses a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the message push method as described above.
The application provides a message pushing method, which comprises the following steps: each server in the websocket service cluster subscribes a user message theme of the redis message middleware; when a service party issues a specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware; each server in the websocket service cluster detects whether target user information is stored locally; the target user information is user information corresponding to the specified message; and the server storing the target user information pushes the received appointed message to a client corresponding to the target user information.
Therefore, according to the method, through a publish-subscribe mode of the redis message middleware, each server in the websocket service cluster subscribes a user message topic, that is, when a service party sends published messages to the redis message middleware, a specified message is broadcasted to each server of the subscribed websocket service cluster, each server in the websocket service cluster receives the specified message, and a client corresponding to target user information can obtain the specified message no matter which server the target user information is stored in; that is, in the application, each server in the websocket service cluster can directly receive the specified message broadcasted by the redis message middleware, and then the server storing the target user information can directly send the specified message to the client, thereby avoiding the defect that in the related art, the server receiving the message needs to access the zookeeper middleware to acquire the information of each other server in the service cluster, and then sends the message to each other server one by one, so as to send the message to the specified client. The application also provides a message pushing device, a message pushing system, electronic equipment and a computer readable storage medium, which have the beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a message pushing method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a websocket real-time message push system according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a service side, a websocket service cluster, and a client for pushing a conventional message;
fig. 4 is a schematic structural diagram of a service provider, a websocket service cluster, and a client for message pushing based on a redis subscription model according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a message pushing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The existing traditional websocket (full duplex communication protocol based on TCP) real-time message push service cannot support high-availability offline message push, and only a single client can be selected for message push. Moreover, under the deployment of the websocket server cluster environment, the situation that the accurate storage node position of the user object cannot be identified exists, so that the push message cannot be effectively sent to the client. In the related technology, information of other servers is acquired by traversing zookeeper (a distributed application program coordination service with open source codes), and then the server sends the received message to other servers, so that the purpose of effectively sending the message to the client is achieved. In this way, zookeeper middleware needs to be accessed first, and then messages are sent to the servers one by one, so that the process is complicated and the efficiency is low.
Based on the foregoing technical problem, this embodiment provides a message pushing method, where each server of a websocket service cluster can directly receive a specified message broadcasted by a redis (key-value storage system serving as a cache) message middleware, and then send the specified message to a client corresponding to target user information, so that the implementation process is simple, efficient, convenient, and fast, and can ensure that the message is effectively sent to the client, specifically refer to fig. 1, where fig. 1 is a flowchart of the message pushing method provided in this embodiment, and specifically includes:
s101, each server in the websocket service cluster subscribes to a user message theme of the redis message middleware.
It is to be appreciated that message middleware is a supportive software system that provides synchronous or asynchronous, reliable message transfer for application systems in a network environment based on queue and messaging techniques. A publisher publishes a message to a channel of the message middleware, which is available to all subscribers subscribing to the channel. In this embodiment, a redis message middleware is adopted, which is more convenient to implement and faster in message transmission rate compared with other message middleware. In this embodiment, each server in the websocket service cluster is used as a user message topic for a subscriber to subscribe to the redis message middleware, and after a publisher (in this embodiment, the publisher is a service party) publishes a message, the redis message middleware receives the message and broadcasts the message to the subscriber, that is, each server in the websocket service cluster. The number of the servers in the websocket service cluster is not limited in this embodiment, and the setting can be performed according to actual situations.
S102, when a service party issues a specified message to a redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware.
It is understood that the specific message in this embodiment may be actively published by the service side, for example, when the package subscribed by the client is due, the service side may actively publish a message to inform the client that the package is due; or when the client sends a request actively, the service party generates a specified message to the client. It will also be appreciated that the business party can send directly to the redis message middleware or can invoke the message distribution service by the business party to send a specified message to the redis message middleware. In a specific embodiment, when a service party issues a specified message to a redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware, which may include:
when a service party calls a message distribution service to send the issued specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware.
In this embodiment, the service party sends the published specific message to the redis message middleware by calling the message distribution service, and it can be understood that, if the service party directly sends the published specific message to the redis message middleware, each service party needs to manage and send the message because of a large number of service parties, and needs corresponding logic, and needs higher development cost.
S103, detecting whether target user information is stored locally by each server in the websocket service cluster; the target user information is user information corresponding to the specified message.
It is understood that a user is randomly registered on a server in the websocket service cluster, and the server stores user information of the user locally. In this embodiment, the user information corresponding to the specified information is the target user information, and it can be understood that the user corresponding to the target user information may actively request the service side to issue the specified message itself, or a target object of the service side actively issuing the specified message is the user corresponding to the target user information. In this embodiment, each server in the websocket service cluster may determine which server stores the target user information by detecting whether the target user information is stored locally.
And S104, the server storing the target user information pushes the received specified message to the client corresponding to the target user information.
In this embodiment, it is detected that the server storing the target user information pushes the received specified message to the client corresponding to the target user information. The embodiment does not limit the specific number of the clients corresponding to the target user information, which may be 1 or 3, and may be, for example, a PC client, a mobile terminal such as a mobile phone, or an H5 mobile terminal, according to the actual situation. In a specific embodiment, the pushing, by the server storing the target user information, the received specified message to the client corresponding to the target user information may include:
when the clients registered with the target user information contain a plurality of clients, the server storing the target user information pushes the received specified message to each client registered with the target user information.
That is, in this embodiment, when a plurality of clients registered with target user information exist, the server storing the target user information pushes all received designated messages to each client. The method can efficiently support simultaneous inference of the messages to multiple clients, and can realize multi-channel message sending.
In a specific embodiment, in order to effectively improve the security of system information interaction, in this embodiment, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, the method may further include:
the method comprises the steps that a server storing target user information receives a CMD connection request of a client corresponding to the target user information;
analyzing the CMD connection request to obtain target user information;
carrying out security verification and authentication on target user information;
and if the verification is passed, executing the step that the server storing the target user information pushes the received specified message to the client corresponding to the target user information.
It can be understood that the target user information corresponds to a user that is registered in the server in advance, and then the registered server stores the target user information. In this embodiment, the server storing the target user information receives a CMD (command prompt) connection request of the client corresponding to the target user information. The embodiment does not limit the specific content of the CMD connection request, and may include message content, user request type, and user identifier. In this embodiment, the CMD connection request is analyzed to obtain the target user information, and the specific process of analyzing the CMD connection request is not limited in this embodiment, and reference may be made to related technologies. Accordingly, the embodiment also does not limit the specific content of the target user information, and may include the user identification information, and may include the user request type, for example, LINK (connection service), CLOSE (service CLOSE), HEARTBEAT detect (HEARTBEAT detect), and MSG (service message). Then, performing security verification and authentication on the target user information obtained by the analysis, wherein it can be understood that the security verification is the verification of the user identity information, for example, verifying whether the user is blacked out or not; the authentication verification is to determine whether the user has the right, which may refer to related technologies, and is not described in detail in this embodiment. And after the verification is passed, the server storing the target user information pushes the received specified message to the client corresponding to the target user information. The method can effectively improve the safety of system information interaction, and prevent a malicious person from tampering user information or using false user information to request a service party to perform related operations.
Further, in order to ensure that the message is not lost, in this embodiment, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, the method may further include:
and if the server storing the target user information detects that the user state in the target user information is offline, storing the specified message in the Mysql database, so that the specified message is sent to the client corresponding to the target user information when the user state in the target user information is online.
In this embodiment, when detecting that the user status of the client logged in with the target user information is not online, the server storing the target user information stores the specified message in the Mysql database, and when the user is online, sends the specified message to the client where the target user information is located. The method can effectively ensure that the message is not lost.
Further, in order to regularly inform the client of the availability of the websocket cluster service, this embodiment may further include:
and after receiving a heartbeat detection request of the client corresponding to the target user information, sending a response signal to the client to inform the client that the current websocket service cluster state is available.
It can be understood that after the client establishes a reliable bidirectional connection with the websocket service cluster, the client may send a HEARTBEAT detection (HEARTBEAT) request to the websocket service cluster regularly and uninterruptedly, and after each server in the websocket cluster service receives the HEARTBEAT detection request of the client corresponding to the target user information, a response signal may be sent to the client to inform the client that the current state of the websocket service cluster is available.
Based on the above technical solution, in this embodiment, through utilizing a publish-subscribe mode of the redis message middleware, each server in the websocket service cluster subscribes a user message topic, that is, when a service party sends a published message to the redis message middleware, a specified message is broadcasted to each server of the subscribed websocket service cluster, each server in the websocket service cluster receives the specified message, and a client corresponding to target user information can finally obtain the specified message no matter in which server the target user information is stored.
The following is a specific embodiment of a websocket real-time message pushing system based on Java application provided in this embodiment. The method can meet the requirement that a user can accurately and effectively receive the notification from the server data under the condition of multi-terminal online, and the message is ensured not to be lost; the user can ensure that the message is not lost under the offline condition, and the delivery rate of the message is effectively improved; the method can effectively and accurately position the position of the node server connected with the client under the deployment of the websocket service cluster environment.
1. Each service party and client (APP/PC/H5) will agree on a message format, i.e. define a complete message interaction structure. The main types of messages can be divided into: LINK (connection service), CLOSE (service CLOSE), HEARTBEAT (HEARTBEAT detect), MSG (service message) are used for interaction and identification of the front-end and back-end.
2. Each server in the Websocket service cluster subscribes a user-msg-topic (user message subject) on a message distribution service in a message subscription model mode of redis message middleware, and then waits for a connection request of a client. Once the request is triggered, the server in the websocekt service cluster analyzes the content of a message body in the CMD connection request according to the CMD connection request sent by the client, identifies the type of the user request, and then performs security authentication and authorization on the identity of the user. After the user information of the client, namely the target user information, is locally stored by using ConcurrentHashMap (guarantee of multithreading safety), and the server simultaneously detects and sends the offline message to the user.
3. The message distribution service can issue the change message data requested by the service party on a user-msg-topic of the redis message middleware, and each cluster node can receive the message data notification due to the broadcast notification of the redis message in the subsequent websocket service cluster, so that the information matched with the local user is sent. If the user is not online, the websocket cluster service stores the message in an offline table in the Mysql database, waits for the subsequent user to reconnect and then repeatedly sends the message, and can ensure that the message is not lost.
4. After the client establishes reliable bidirectional connection with the websocket service cluster, the client can regularly and uninterruptedly send a heartbeat detection request to the websocket service cluster to ensure the availability of the websocket service cluster, and the websocket service cluster can send a response signal to the client to inform the client that the current state of the websocket service cluster is available.
Fig. 2 is a schematic structural diagram of a websocket real-time message push system provided in this embodiment. Wherein, Msg-Router-Node-1 refers to message distribution service Node 1, Msg-Router-Node-2 refers to message distribution service Node 2, and Msg-Router-Node-3 refers to message distribution service Node 3.
1. Firstly, deploying a plurality of (> ═ 2) websocket service cluster servers and 1 or more message distribution services;
2. the message distribution service starts a subscription model user-msg-topic of the redis message middleware, and the websocket service cluster subscribes the message distribution service;
3. a client (app/h5/pc) initiates a LINK request to a websocket service cluster to establish connection;
4. a business side pushes 100 pieces of test data prepared in advance to a message distribution service, the message distribution service can broadcast messages to a websocket service cluster through a user-msg-topic of a redis message middleware subscription model, each server in the websocket service cluster matches user information of each cluster node after receiving the broadcast, and if the fact that the user information is stored locally is detected, the server storing the user information pushes the messages;
5. and finally, the three ends of the client (app/h5/pc) can receive 100 message data reminders at the same time.
Fig. 3 is a schematic structural diagram of a service party, a websocket service cluster, and a client for pushing a conventional message, in which a BizServer represents the service party, and a ws connection represents a websocket communication connection; fig. 4 is a schematic structural diagram of a message pushing method based on a redis subscription model, which relates to a business party, a websocket service cluster, and a client.
Based on the technical scheme, multiple clients cannot be supported to push dynamic messages in the related technology, and specific service nodes stored in a user connection mode cannot be accurately positioned under the websocket service cluster environment.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a message pushing apparatus according to an embodiment of the present disclosure, where the message pushing apparatus described below and the message pushing method described above may be referred to correspondingly, and the relevant modules are all disposed therein, and the message pushing apparatus includes:
in some specific embodiments, the method specifically includes:
the subscription module 501 is used for subscribing user message topics of the redis message middleware by each server in the websocket service cluster;
the receiving module 502 is used for receiving the specified message broadcasted by the redis message middleware by each server in the websocket service cluster when the service party issues the specified message to the redis message middleware;
a determining module 503, configured to detect whether target user information is stored locally in each server in the websocket service cluster; the target user information is user information corresponding to the specified message;
the pushing module 504 is configured to push the received specified message to the client corresponding to the target user information by the server storing the target user information.
In some specific embodiments, the method further comprises:
and the storage module is used for storing the specified message in the Mysql database if the server storing the target user information detects that the user state in the target user information is offline, so that the specified message is sent to the client corresponding to the target user information when the user state in the target user information is online.
In some specific embodiments, the receiving module 502 includes:
and the receiving unit is used for receiving the specified message broadcasted by the redis message middleware by each server in the websocket service cluster when the service party calls the message distribution service to send the issued specified message to the redis message middleware.
In some specific embodiments, the pushing module 504 includes:
and the pushing unit is used for pushing the received specified message to each client registered with the target user information by the server stored with the target user information when the plurality of clients registered with the target user information are included.
In some specific embodiments, the method further comprises:
the connection receiving request module is used for receiving a CMD connection request of a client corresponding to the target user information by the server storing the target user information;
the analysis module is used for analyzing the CMD connection request to obtain target user information;
the checking module is used for carrying out safety verification and authentication on the target user information;
in some specific embodiments, the method further comprises:
and the sending module is used for sending a response signal to the client after receiving the heartbeat detection request of the client corresponding to the target user information so as to inform the client that the current websocket service cluster state is available.
Since the embodiment of the message pushing apparatus part corresponds to the embodiment of the message pushing method part, please refer to the description of the embodiment of the message pushing method part, which is not repeated here.
The present application further discloses a message pushing system, including:
the service side is used for issuing the specified message to the redis message middleware so that the redis message middleware broadcasts the specified message to each server in the websocket service cluster;
each server in the websocket service cluster is used for executing the steps of the message pushing method;
and the client is used for receiving a specified message sent by the server in the websocket service cluster, wherein the server stores the target user information.
Since the embodiment of the message push system part corresponds to the embodiment of the message push method part, please refer to the description of the embodiment of the message push method part, which is not repeated here.
In the following, an electronic device provided in an embodiment of the present application is introduced, and the electronic device described below and the message pushing method described above may be referred to correspondingly.
The application also discloses an electronic device, including:
a memory for storing a computer program;
a processor for implementing the steps of the message pushing method when executing the computer program.
Since the embodiment of the electronic device portion corresponds to the embodiment of the message pushing method portion, please refer to the description of the embodiment of the message pushing method portion for the embodiment of the electronic device portion, which is not repeated here.
In the following, a computer-readable storage medium provided by an embodiment of the present application is introduced, and the computer-readable storage medium described below and the message pushing method described above may be referred to correspondingly.
The application also discloses a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the above message pushing method.
Since the embodiment of the computer-readable storage medium portion corresponds to the embodiment of the message pushing method portion, please refer to the description of the embodiment of the message pushing method portion for the embodiment of the computer-readable storage medium portion, which is not repeated here.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
A message pushing method, a message pushing device, a message pushing system, an electronic device, and a computer-readable storage medium are described above in detail. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A message pushing method is applied to a websocket service cluster and comprises the following steps:
each server in the websocket service cluster subscribes a user message theme of the redis message middleware;
when a service party issues a specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware;
each server in the websocket service cluster detects whether target user information is stored locally; the target user information is user information corresponding to the specified message;
and the server storing the target user information pushes the received appointed message to a client corresponding to the target user information.
2. The message pushing method according to claim 1, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, further comprising:
if the server storing the target user information detects that the user state in the target user information is offline, the designated message is stored in the Mysql database, and when the user state in the target user information is online, the designated message is sent to the client corresponding to the target user information.
3. The message pushing method according to claim 1, wherein when the service party issues a specific message to the redis message middleware, each server in the websocket service cluster receives the specific message broadcasted by the redis message middleware, including:
and when the service party calls a message distribution service to send the issued specified message to the redis message middleware, each server in the websocket service cluster receives the specified message broadcasted by the redis message middleware.
4. The message pushing method according to claim 1, wherein the pushing, by the server storing the target user information, the received specified message to the client corresponding to the target user information includes:
and when the clients registered with the target user information comprise a plurality of clients, the server storing the target user information pushes the received appointed message to each client registered with the target user information.
5. The message pushing method according to claim 1, before the server storing the target user information pushes the received specified message to the client corresponding to the target user information, further comprising:
the server storing the target user information receives a CMD connection request of a client corresponding to the target user information;
analyzing the CMD connection request to obtain the target user information;
performing security verification and authentication on the target user information;
and if the verification is passed, executing the step that the server storing the target user information pushes the received appointed message to a client corresponding to the target user information.
6. The message pushing method according to claim 1, further comprising:
and after receiving a heartbeat detection request of the client corresponding to the target user information, sending a response signal to the client to inform the client that the current state of the websocket service cluster is available.
7. A message pushing device applied to a websocket service cluster comprises:
the subscription module is used for subscribing the user message theme of the redis message middleware by each server in the websocket service cluster;
the receiving module is used for receiving the specified message broadcasted by the redis message middleware by each server in the websocket service cluster when a service party publishes the specified message to the redis message middleware;
the determining module is used for detecting whether target user information is stored locally in each server in the websocket service cluster; the target user information is user information corresponding to the specified message;
and the pushing module is used for pushing the received appointed message to a client corresponding to the target user information by the server in which the target user information is stored.
8. A message push system, comprising:
the service side is used for issuing a specified message to the redis message middleware so that the redis message middleware broadcasts the specified message to each server in the websocket service cluster;
each server in the websocket service cluster, configured to perform the steps of the message pushing method according to any one of claims 1 to 6;
and the client is used for receiving the specified message sent by the server in which the target user information is stored in the websocket service cluster.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for implementing the steps of the message push method according to any of claims 1 to 6 when executing said computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the message push method according to any one of claims 1 to 6.
CN202110460984.1A 2021-04-27 2021-04-27 Message pushing method, device, system, electronic equipment and storage medium Pending CN113157466A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110460984.1A CN113157466A (en) 2021-04-27 2021-04-27 Message pushing method, device, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110460984.1A CN113157466A (en) 2021-04-27 2021-04-27 Message pushing method, device, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113157466A true CN113157466A (en) 2021-07-23

Family

ID=76871397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110460984.1A Pending CN113157466A (en) 2021-04-27 2021-04-27 Message pushing method, device, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113157466A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113553511A (en) * 2021-07-30 2021-10-26 中国建设银行股份有限公司 User real-time recommendation method, device, system, equipment and readable storage medium
CN114143334A (en) * 2021-12-03 2022-03-04 爱信诺征信有限公司 Terminal control method and device
CN114328618A (en) * 2021-11-30 2022-04-12 苏州浪潮智能科技有限公司 Cache data synchronization method, device, equipment and storage medium
CN115086292A (en) * 2022-06-15 2022-09-20 浙江省标准化研究院(金砖国家标准化(浙江)研究中心、浙江省物品编码中心) Distributed instant server push scheme architecture design method, device and storage medium
CN115442220A (en) * 2022-08-24 2022-12-06 浪潮云信息技术股份公司 Websocket Session sharing method and system based on cluster deployment
CN115514731A (en) * 2022-09-22 2022-12-23 中国农业银行股份有限公司 Message pushing method, device, medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110198351A (en) * 2019-05-29 2019-09-03 深圳前海微众银行股份有限公司 Storage method, device, server-side and the readable storage medium storing program for executing of offline message
CN111031058A (en) * 2019-12-23 2020-04-17 集奥聚合(北京)人工智能科技有限公司 Websocket-based distributed server cluster interaction method and device
CN111106996A (en) * 2019-12-28 2020-05-05 安徽微沃信息科技股份有限公司 WebSocket and cache-based multi-terminal online chat system
CN111565229A (en) * 2020-04-29 2020-08-21 创盛视联数码科技(北京)有限公司 Communication system distributed method based on Redis
CN112612985A (en) * 2020-12-24 2021-04-06 广州致远电子有限公司 Websocket-based multi-user and multi-type message pushing system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110198351A (en) * 2019-05-29 2019-09-03 深圳前海微众银行股份有限公司 Storage method, device, server-side and the readable storage medium storing program for executing of offline message
CN111031058A (en) * 2019-12-23 2020-04-17 集奥聚合(北京)人工智能科技有限公司 Websocket-based distributed server cluster interaction method and device
CN111106996A (en) * 2019-12-28 2020-05-05 安徽微沃信息科技股份有限公司 WebSocket and cache-based multi-terminal online chat system
CN111565229A (en) * 2020-04-29 2020-08-21 创盛视联数码科技(北京)有限公司 Communication system distributed method based on Redis
CN112612985A (en) * 2020-12-24 2021-04-06 广州致远电子有限公司 Websocket-based multi-user and multi-type message pushing system and method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113553511A (en) * 2021-07-30 2021-10-26 中国建设银行股份有限公司 User real-time recommendation method, device, system, equipment and readable storage medium
CN114328618A (en) * 2021-11-30 2022-04-12 苏州浪潮智能科技有限公司 Cache data synchronization method, device, equipment and storage medium
CN114328618B (en) * 2021-11-30 2024-02-09 苏州浪潮智能科技有限公司 Cache data synchronization method, device, equipment and storage medium
CN114143334A (en) * 2021-12-03 2022-03-04 爱信诺征信有限公司 Terminal control method and device
CN114143334B (en) * 2021-12-03 2024-04-09 爱信诺征信有限公司 Terminal control method and device
CN115086292A (en) * 2022-06-15 2022-09-20 浙江省标准化研究院(金砖国家标准化(浙江)研究中心、浙江省物品编码中心) Distributed instant server push scheme architecture design method, device and storage medium
CN115442220A (en) * 2022-08-24 2022-12-06 浪潮云信息技术股份公司 Websocket Session sharing method and system based on cluster deployment
CN115514731A (en) * 2022-09-22 2022-12-23 中国农业银行股份有限公司 Message pushing method, device, medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN113157466A (en) Message pushing method, device, system, electronic equipment and storage medium
CN109547511B (en) WEB message real-time pushing method, server, client and system
CN111371892A (en) High-concurrency distributed message pushing system and method
CN108897854B (en) Monitoring method and device for overtime task
CN113067882A (en) Message processing method and device, electronic equipment and medium
CN105991412A (en) Method and device for pushing message
WO2021237433A1 (en) Message pushing method and apparatus, and electronic device and computer-readable medium
CN114024972B (en) Long connection communication method, system, device, equipment and storage medium
WO2016010921A1 (en) Creating a user group
CN113220435A (en) Task processing method and related product
CN113360301B (en) Message transmission system and method
CN111541555A (en) Group chat optimization method and related product
CN111092904B (en) Network connection method and device
CN111669315A (en) Message pushing method, device and system, electronic equipment and readable storage medium
CN106411713B (en) State notification method and server
CN111277544B (en) Communication method, system and related equipment
CN113542337B (en) Information sharing method and device, electronic equipment and storage medium
CN113132745B (en) Live broadcast service system, method and server
CN115632815A (en) Data updating method and device, electronic equipment and storage medium
CN114979097B (en) Message pushing method and device based on MQTT and electronic equipment
CN112511884B (en) Mixed flow control method, system and storage medium for audio and video flow
WO2014015795A1 (en) Method and device for providing communication connection for multiple candidate applications in mobile device
CN112653747A (en) Communication method, system and storage medium based on B/S architecture
CN110213322B (en) Content publishing processing method, client and server for community
CN113794620A (en) Message sending method, device, equipment, system and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210723

RJ01 Rejection of invention patent application after publication