High-performance message group sending method, device and equipment based on instant messaging

By storing group messages on the target server in the instant communication system and distinguishing online and offline devices, and using online gateways to push messages, the problem of offline users being online when there are many groups of people is solved, which affects online users' sending and receiving, and improves message delivery efficiency and system performance.

CN120512418APending Publication Date: 2025-08-19HANGZHOU AKEY ME CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510793956.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In real-time communication, when there are many groups of people, offline users will go online to pull messages and affect the online users' message sending and receiving efficiency, resulting in excessive latency and resource consumption.

Method used

By storing group messages to be sent in the target server, distinguishing the current offline device from the online device, and using the online gateway to push messages, avoiding interference with online users when offline users are online, and at the same time, using the cache to store offline messages and push them when the device is online.

Benefits of technology

It improves the message sending and receiving efficiency of online users, reduces storage overhead and resource consumption, improves the overall message push performance, and ensures timely delivery of messages and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120512418A_ABST
    Figure CN120512418A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of instant messaging, and discloses a high-performance message group sending method, device and equipment based on instant messaging, and the method comprises the steps: obtaining a to-be-sent group message of a target group, determining a target server based on the to-be-sent group message, and storing the to-be-sent group message in the target server; determining a current offline device and a current online device according to the current connection device of the target server; and determining an online gateway based on the group identifier of the target group, and sending the to-be-sent group message to the current online device based on the online gateway. According to the invention, the message to be massively sent is stored in the target server, the group message only stores a single message and a maximum site, the storage overhead is reduced, the current offline device and the current online device are distinguished, pushing is carried out on the current online device based on the online gateway, and the problem that the message is pushed to the current online device when the number of people in the group is large is avoided. The online pull message of the offline user affects the message receiving and sending of the online user, so that the receiving and sending of the online user are more timely, and the overall message pushing performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of instant messaging technology, and in particular to a high-performance group messaging method, device and equipment based on instant messaging. Background Art

[0002] Instant Messaging (IM) is an Internet-based real-time communication technology that allows users to communicate instantly through text, voice, video, and other means. Currently, commonly used IMs include: (1) Each person has an inbox. When sending group messages, regardless of whether the user is online or not, a message needs to be written in everyone's inbox and then pushed. This is the classic "write-spread" method. Most of the mainstream group chats such as WeChat and WeChat for Business use this technology; (2) The inbox dimension is removed from the recipient dimension. Group messages only need to be recorded in one message, and each recipient actively "reads and spreads" the message.

[0003] Simple write diffusion consumes significant resources for large groups, and the larger the group, the higher the message latency. For example, in a group of 10,000 people, the time between the first and last person receiving a message can vary by more than 5 seconds. Furthermore, because a message must be pre-written to each user's inbox, database overhead is very high. Read diffusion theoretically addresses the performance issues for large groups, but its implementation is costly. After writing a group message, each user must retrieve the message for their group. Therefore, regardless of which method is used, group messaging efficiency decreases as the number of users increases. This is especially true when a large number of users frequently switch between online and offline network states during group messaging. When offline users come online and repeatedly retrieve messages, this interferes with the messaging of online users. Preventing offline users from accessing messages and impacting the messaging of online users is a key issue that needs to be addressed, thereby improving the system's group messaging performance. Summary of the Invention

[0004] In view of this, the present invention provides a high-performance group messaging method, device and equipment based on instant messaging to solve the problem that when there are a large number of people in a group, offline users pulling messages online affects the message sending and receiving of online users.

[0005] In a first aspect, the present invention provides a high-performance group messaging method based on instant messaging, the method comprising:

[0006] Obtaining a pending group message of a target group, determining a target server based on the pending group message, and storing the pending group message in the target server;

[0007] Determine the current offline device and the current online device based on the current connected device of the target server;

[0008] An online gateway is determined based on the group identifier of the target group, and the to-be-sent group message is sent to the current online device based on the online gateway.

[0009] The high-performance group messaging method based on instant messaging provided by the present invention reduces storage overhead by storing the messages to be sent to the group in the target server, and only storing a single message and a maximum location in the group message. By distinguishing between the current offline device and the current online device, the method pushes messages to the current online device based on the online gateway, thereby avoiding the situation where the offline user pulls messages online and affects the message sending and receiving of the online user when there are a large number of people in the group, making the sending and receiving of the online user more timely and improving the overall message push performance.

[0010] In an optional embodiment, the method further includes:

[0011] When it is detected that the currently offline device is back online, a group message query request is obtained from the newly online device;

[0012] determining whether there is a group offline message in the target server according to the group message query request, and storing the group offline message in a buffer of the target server;

[0013] If there is a group offline message in the target server, the group offline message will be pushed to the corresponding newly online device through the offline gateway.

[0014] The high-performance group messaging method based on instant messaging provided by the present invention detects the online status of offline devices in real time and pushes group offline messages to newly online devices based on group message query requests, thereby avoiding message omissions caused by offline devices. The cache is used to store offline messages to avoid repeated generation and transmission of the same content. At the same time, a unified push mechanism of the gateway is used to achieve lightweight message distribution and improve server resource utilization.

[0015] In an optional implementation, the group message query request of the newly online device includes a user-group relationship identifier, and determining whether there is a group offline message in the target server according to the group message query request includes:

[0016] Determine the message sequence identifiers received by the group to be queried and the newly online device based on the user-group relationship identifier;

[0017] According to the group to be queried, the offline messages of the group to be queried in the target server and the message sequence identifier corresponding to the offline messages are determined, and according to the message sequence identifier received by the newly online device and the message sequence identifier corresponding to the offline message, it is determined whether there is a group offline message. The group offline message is an offline message that has not been received by the newly online device.

[0018] The high-performance group messaging method based on instant messaging provided by the present invention locks the group to which the user belongs and the received message sequence through the user-group relationship identifier, can accurately match the offline messages of the group to be queried in the server, avoid interference from irrelevant messages, and improve message retrieval efficiency. Based on the comparison of message sequence identifiers, only offline messages that have not been received by the device are pushed, which ensures that the user fully obtains the missed content and avoids the repeated sending of received messages, thereby reducing data transmission volume and device resource consumption.

[0019] In an optional implementation, determining whether there is a group offline message based on a message sequence identifier received by the newly online device and a message sequence identifier corresponding to an offline message includes:

[0020] If the message sequence identifier received by the newly online device is smaller than the message sequence identifier corresponding to the offline message, a group offline message exists;

[0021] If the message sequence identifier received by the newly online device is equal to the message sequence identifier corresponding to the offline message, there is no group offline message.

[0022] The high-performance group messaging method based on instant messaging provided by the present invention eliminates the need for the server to traverse all offline messages through precise matching of sequence identifiers, reducing computing pressure; at the same time, gateway push is more targeted, improving the overall response speed and stability of the system, and enhancing users' real-time perception of message synchronization.

[0023] In an optional implementation, the process of determining the message sequence identifier includes:

[0024] Get the message ID and corresponding timestamp of the message to be sent to the group. The message ID is a non-natural sequence self-incrementing ID.

[0025] The message identifiers are arranged in chronological order according to the timestamps, and the arranged message identifiers are sequentially numbered to obtain a message sequence identifier, which is a natural sequence self-incrementing identifier.

[0026] The high-performance group messaging method based on instant messaging provided by the present invention sorts non-natural sequence message identifiers by timestamp and generates natural sequence self-incrementing message sequence identifiers, converting the disordered original message identifiers into an ordered linear sequence. The standardized natural sequence identifiers can quickly locate the range of messages not received by the device through simple numerical comparison, avoiding complex timestamp parsing and comparison operations, significantly reducing server computing overhead, and improving message matching efficiency. The natural sequence identifier ensures that messages are resent in the order of their actual generation time, avoiding message confusion or omissions caused by the disorder of the original identifiers. Especially in the high-frequency group message sending scenario, the correctness of the time sequence of user received messages is strictly guaranteed, improving the reliability of information transmission and user experience.

[0027] In an optional implementation, determining the current offline device and the current online device according to the current connected device of the target server includes:

[0028] Obtaining group member tags of the target group, and determining online group members currently connected to the target server and offline group members not connected to the target server based on the group member tags;

[0029] The device corresponding to the online group member is used as the current online device, and the device corresponding to the offline group member is used as the current offline device.

[0030] The high-performance group messaging method based on instant messaging provided by the present invention accurately distinguishes the current online devices and offline devices in the target group through group member tags, providing basic data support for subsequent message push strategies. The clear device status division helps to optimize server resource allocation, prioritizes real-time message transmission for online devices, adopts a temporary storage strategy for offline devices, reduces invalid server connection consumption, enhances the stability and efficiency of system operation, and ensures the smoothness and intelligence of the group message transmission link.

[0031] In an optional implementation, sending the to-be-sent group message to the currently online device based on the online gateway includes:

[0032] Performing structured encoding on the to-be-sent group message according to the first data protocol to obtain a first encoded message;

[0033] The first coded message is binary-processed to obtain a second coded message, and the second coded message is sent to the current online device according to the second data protocol.

[0034] The present invention provides a high-performance group messaging method based on instant messaging. The second data protocol is only responsible for online subscription distribution and has no persistent messages, which is conducive to the transmission of the second encoded message, so that the online gateway is not affected by the message pulling of new online devices, thereby improving system performance.

[0035] In a second aspect, the present invention provides a high-performance group messaging device based on instant messaging, the device comprising:

[0036] A group message acquisition module is used to acquire the to-be-sent group message of the target group, determine the target server based on the to-be-sent group message, and store the to-be-sent group message in the target server;

[0037] An online device determination module is used to determine the current offline device and the current online device according to the current connected device of the target server;

[0038] The online sending module is used to determine the online gateway based on the group identifier of the target group, and send the to-be-sent group message to the current online device based on the online gateway.

[0039] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 1 is a flow chart of a high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0043] Figure 2 is a flowchart of another high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0044] Figure 3 1 is a flow chart of offline / online push distribution of group messages in a high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0045] Figure 4 1 is a flow chart of offline message push by an offline module in a high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0046] Figure 5 is a flowchart of another high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0047] Figure 6 This is a flow chart of online push distribution of group messages in a high-performance group messaging method based on instant messaging according to an embodiment of the present invention;

[0048] Figure 7 is a structural block diagram of a high-performance group messaging device based on instant messaging according to an embodiment of the present invention;

[0049] Figure 8 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0050] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0051] The embodiment of the present invention provides a high-performance group messaging method based on instant messaging. By splitting the online push and offline push of group messages, it is achieved to avoid the situation where offline users pulling messages online affect the message sending and receiving of online users when there are a large number of people in the group, so that online users can send and receive messages more promptly.

[0052] According to an embodiment of the present invention, an embodiment of a high-performance group messaging method based on instant messaging is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0053] In this embodiment, a high-performance group messaging method based on instant messaging is provided, which can be used in the above-mentioned computer system. Figure 1 Flowchart of a high-performance group messaging method based on instant messaging according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0054] Step S101: obtaining a to-be-sent group message of a target group, determining a target server based on the to-be-sent group message, and storing the to-be-sent group message in the target server.

[0055] Specifically, a target group is a group of multiple users created using instant messaging chat software (such as WeChat, QQ, etc.). The process of sending and receiving group messages in the target group involves the sending user using their personal device to send the pending group message to the target server. The target server then distributes the pending group message to other users in the target group according to the agreed message delivery policy. Instant messaging chat software has deployed a large number of server nodes around the world. When a user sends a group message, the chat software on their device first queries the server list. Then, the chat software determines the user's approximate geographic location based on the device IP address, filters out a list of servers in the nearby area, and then selects a target server to connect to by performing speed tests or searching for the server with the fewest connections, ensuring efficient communication.

[0056] Each group in a chat app has a globally unique identifier (identity document, ID), denoted as groupid. Each group's generated group message also has a unique identifier, denoted as msgid. Each user's terminal device also has a globally unique identifier, denoted as deviceid. After the target group generates a group message to be sent, it selects a target server and stores the groupid and msgid on the target server. Only one message needs to be stored.

[0057] Step S102: determining the current offline device and the current online device according to the current connected device of the target server.

[0058] Specifically, the terminal device can be made to periodically send a "heartbeat packet" without actual business data to the target server to determine the "survival status" (offline or online) of the terminal device. If the target server can continuously receive the "heartbeat packet" sent by a terminal device, the corresponding terminal device is online; otherwise, the terminal device is offline. The terminal device of the group user who is online is the currently connected device, that is, the currently online device, and the group message to be sent can be directly sent to the currently online device. For the currently offline device, group messages can be temporarily not pushed to it to save resources and ensure that the currently online device sends and receives group messages in a timely manner.

[0059] Step S103: determining an online gateway based on the group identifier of the target group, and sending the to-be-sent group message to the current online device based on the online gateway.

[0060] Specifically, after the online module in the target server receives the group message to be sent, it addresses the group according to the group identifier groupid and determines the online gateway corresponding to the groupid, such as mqtt1, mqtt2, and mqtt3. The target server allocates the nearest online gateway based on the geographical location of the current online device. The number of online gateways is related to the geographical location of the current online device. It is possible that multiple current online devices use one online gateway at the same time. This is only an example, but not limited to this.

[0061] The high-performance group messaging method based on instant messaging provided in this embodiment reduces storage overhead by storing the messages to be sent in the target server. The group message only stores a single message and a maximum location. It distinguishes between the current offline device and the current online device, and pushes messages to the current online device based on the online gateway. This avoids the situation where offline users come online to pull messages and affect the message sending and receiving of online users when there are a large number of people in the group. It makes the sending and receiving of online users more timely, and improves the overall message push performance.

[0062] In some optional embodiments, such as Figure 2 As shown, the method further includes:

[0063] Step S104: When it is detected that the currently offline device is back online, a group message query request of the newly online device is obtained.

[0064] Step S105: determining whether there is a group offline message in the target server according to the group message query request, and storing the group offline message in a buffer of the target server.

[0065] Specifically, the pending group messages stored in the target server, in addition to being sent directly to the current online device through the online module, will also be stored in the cache of the target server. The cache will also mark the latest message location of the group, for example, groupId1:seq1, where groupId1 represents the identifier of the target group, and seq1 represents the message sequence identifier corresponding to the msgid of the pending group message.

[0066] For devices currently offline or experiencing chattering online messages, the offline module can be used to ensure accurate delivery of group messages. The target server will detect in real time whether the currently offline device has returned online. If so, the newly online device will send its group ID and received message sequence seq0 to the target server's offline module, querying whether any group offline messages have been sent to the target server.

[0067] Step S106: If there is a group offline message in the target server, the group offline message is pushed to the corresponding newly online device through the offline gateway.

[0068] Specifically, the target server determines the target group based on the group ID groupid of the newly online device received, and then determines whether there is a group offline message that the newly online device has not received based on the message sequence ID seq1 cached in the target server and the message sequence seq0 received by the newly online device. If there is a group offline message, the group offline message is directly pushed to the corresponding newly online device through the offline gateway.

[0069] It should be noted that if Figure 3 As shown, for the pending group messages of the target group, according to the status of the client device, the server is divided into two situations: offline and online to distribute the pending group messages. The offline gateway and the online gateway use different communication protocols to avoid mutual influence and improve system stability and performance. For example, the online gateway uses the MQTT protocol and the offline gateway uses the HTTP protocol. The online gateway MQTT can be sent to the client of the group members in the target group by local scanning. The offline module is passive, and the newly online device actively pulls it online. The two modules do not affect each other. This is just an example, but not limited to this.

[0070] The high-performance group messaging method based on instant messaging provided in this embodiment detects the online status of offline devices in real time and pushes group offline messages to newly online devices based on group message query requests, thereby avoiding message omissions caused by offline devices. The cache is used to store offline messages to avoid repeated generation and transmission of the same content. At the same time, the unified push mechanism of the gateway is used to achieve lightweight message distribution and improve server resource utilization.

[0071] In some optional implementations, the group message query request of the newly online device includes a user-group relationship identifier, and the above step S105 includes:

[0072] Step S1051: Determine, based on the user-group relationship identifier, the message sequence identifiers received by the group to be queried and the newly online device.

[0073] Specifically, when a user establishes a group chat using instant messaging chat software, a group information table is automatically generated, as shown in Table 1. The group information table records the group identifier group_id, group name group_name, and the latest group message sequence group_msg_seq.

[0074] Table 1

[0075] group_id Group ID number group_name Group name, such as xx company communication group group_msg_seq The group's latest message seq

[0076] When a user applies to join the target group or passively joins the target group, a configuration record is automatically generated to mark the group user's identity, status, and other information. Therefore, each member in the target group corresponds to a group member tag table as shown in Table 2. Regardless of the number of group messages, the relationship between a group member and the target group is only one, as shown in Table 2. If the target group contains 10,000 group members, there will be 10,000 records as shown in Table 2.

[0077] Table 2

[0078]

[0079]

[0080] When a group member needs to send a group message in the group, a group message record table as shown in Table 3 is automatically generated.

[0081] Table 3

[0082]

[0083] The "id" in Table 2 represents the user-group relationship identifier. The group message query request automatically sent by the newly online device after it comes online contains the contents of the group member tag table in Table 2. After the target server receives the group member tag table, it determines the group to be queried based on the user-group relationship identifier, and determines the message sequence identifier (seq_client) received by the newly online device based on the message position sequence number seq read by the user in this group. For example, the message sequence identifier of the newly online device in the target group groupidA is seq=8, which means that the newly online device has received the 8th group message in groupidA.

[0084] Step S1052: Determine the offline messages of the group to be queried in the target server and the message sequence identifiers corresponding to the offline messages based on the group to be queried, and determine whether there are group-sent offline messages based on the message sequence identifiers received by the newly online device and the message sequence identifiers corresponding to the offline messages. Group-sent offline messages are offline messages that have not been received by the newly online device.

[0085] Specifically, based on the group information table corresponding to the group to be queried, the current latest message sequence identifier group_msg_seq of the group is determined, and the content of the offline message of the group is determined based on Table 3. By comparing the message sequence identifier received by the newly online device and the message sequence identifier (seq_server) corresponding to the offline message, it is determined whether there is a group offline message. The group offline message is an offline message that has not been received by the newly online device.

[0086] The high-performance group messaging method based on instant messaging provided in this embodiment locks the group to which the user belongs and the received message sequence through the user-group relationship identifier, can accurately match the offline messages of the group to be queried in the server, avoid interference from irrelevant messages, and improve message retrieval efficiency. Based on the comparison of message sequence identifiers, only offline messages that have not been received by the device are pushed, which ensures that the user fully obtains the missed content and avoids the repeated sending of received messages, thereby reducing data transmission volume and device resource consumption.

[0087] In some optional implementations, determining whether there is a group offline message in step S1052 based on the message sequence identifier received by the newly online device and the message sequence identifier corresponding to the offline message includes:

[0088] If the message sequence identifier received by the newly online device is smaller than the message sequence identifier corresponding to the offline message, a group offline message exists.

[0089] If the message sequence identifier received by the newly online device is equal to the message sequence identifier corresponding to the offline message, there is no group offline message.

[0090] Specifically, if Figure 4The figure below shows the process flow of the offline module processing offline messages. If the message sequence number received by the newly online device is 8, it indicates that the newly online device has received the first eight messages in the target group. If the message sequence number corresponding to the offline message is 10, it means that 10 messages have been sent to the target group, of which the 9th and 10th messages are group offline messages from the newly online device. If the message sequence number corresponding to the offline message is 8, it means that 8 messages have been sent to the target group, indicating that the newly online device has received all messages in the target group. For the newly online device, there are no group offline messages in the target group.

[0091] The high-performance group messaging method based on instant messaging provided in this embodiment eliminates the need for the server to traverse all offline messages through precise matching of sequence identifiers, thereby reducing computing pressure. At the same time, gateway push is more targeted, improving the overall response speed and stability of the system and enhancing users' real-time perception of message synchronization.

[0092] In some optional implementations, the process of determining the message sequence identifier includes:

[0093] Get the message ID and corresponding timestamp of the message to be sent to the group. The message ID is a non-natural sequence self-incrementing ID.

[0094] The message identifiers are arranged in chronological order according to the timestamps, and the arranged message identifiers are sequentially numbered to obtain a message sequence identifier, which is a natural sequence self-incrementing identifier.

[0095] Specifically, when obtaining the message identifier and the corresponding timestamp of the message to be sent to a group, the message identifier is generated using a non-natural sequence self-incrementing rule, such as a unique identifier based on a combination of UUID, hash value or business code, to ensure the global uniqueness and discontinuity of the identifier. After obtaining, the message identifiers need to be sorted in time sequence by timestamp: (1) extract the timestamp of each message (accurate to milliseconds) to ensure the accuracy of the time dimension; (2) use a stable sorting algorithm (such as merge sort) to arrange the message identifiers in ascending order by timestamp, ensuring that the order of messages with the same timestamp can be customized (such as in lexicographic order of identifiers); (3) assign a natural sequence self-incrementing message sequence identifier to the sorted message list starting from 1 to form a continuous logical order (such as the first message sequence identifier is 1, and the Nth message sequence identifier is N).

[0096] Sorting message identifiers by timestamp realizes the mapping of discontinuous physical identifiers to continuous logical sequences, which facilitates the subsequent message sending scheduling, status tracking and retransmission mechanism design, ensures that group tasks are executed in order according to time priority, and improves the traceability of message processing and system stability.

[0097] The high-performance group messaging method based on instant messaging provided in this embodiment sorts non-natural sequence message identifiers by timestamp and generates natural sequence self-incrementing message sequence identifiers, converting the disordered original message identifiers into an ordered linear sequence. The standardized natural sequence identifiers can quickly locate the range of messages not received by the device through simple numerical comparison, avoiding complex timestamp parsing and comparison operations, significantly reducing server computing overhead, and improving message matching efficiency. The natural sequence identifier ensures that messages are resent in the order of their actual generation time, avoiding message confusion or omissions caused by the disorder of the original identifiers. Especially in the high-frequency group message sending scenario, the natural sequence identifier strictly guarantees the time sequence correctness of user received messages, improving the reliability of information transmission and user experience.

[0098] In this embodiment, a high-performance group messaging method based on instant messaging is provided, which can be used in the above-mentioned computer system. Figure 5 Flowchart of a high-performance group messaging method based on instant messaging according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:

[0099] Step S201: Obtain the target group's pending group message, determine the target server based on the pending group message, and store the pending group message in the target server. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0100] Step S202: determining the current offline device and the current online device according to the current connected device of the target server.

[0101] Specifically, the above step S202 includes:

[0102] Step S2021: Acquire group member tags of the target group, and determine online group members currently connected to the target server and offline group members not connected to the target server based on the group member tags.

[0103] Specifically, using the group member tag user_id shown in Table 2 can help the target server accurately identify online users and offline users in the target group. Figure 6 The figure shows a flow chart of online distribution of group messages to be sent. After the online module receives the group message to be sent, it determines the target group according to the group identifier of the group message to be sent, addresses the corresponding online gateway node according to the target group, and then distributes the group message to be sent to at least one online device terminal through the online gateway node.

[0104] Step S2022: The device corresponding to the online group member is used as the current online device, and the device corresponding to the offline group member is used as the current offline device.

[0105] Specifically, the terminal devices corresponding to the online group members are used as current online devices, and the terminal devices corresponding to the offline group members are used as current offline devices.

[0106] The high-performance group messaging method based on instant messaging provided in this embodiment accurately distinguishes between current online devices and offline devices in the target group through group member tags, providing basic data support for subsequent message push strategies. The clear device status division helps to optimize server resource allocation, prioritizes real-time message transmission for online devices, and adopts a temporary storage strategy for offline devices, reducing server invalid connection consumption, enhancing the stability and efficiency of system operation, and ensuring the smoothness and intelligence of the group message transmission link.

[0107] Step S203: determining an online gateway based on the group identifier of the target group, and sending the to-be-sent group message to the current online device based on the online gateway.

[0108] Specifically, the above step S203 includes:

[0109] Step S2031: Structured encoding is performed on the to-be-sent group message according to the first data protocol to obtain a first encoded message.

[0110] Specifically, the online gateway is a gateway that performs message encoding, decoding and communication. In this embodiment, the first data protocol is the protobuf data protocol. The group message to be sent is structured encoded according to the protobuf data protocol to obtain a first encoded message encode(msg).

[0111] Step S2032: Binary processing is performed on the first coded message to obtain a second coded message, and the second coded message is sent to the current online device according to the second data protocol.

[0112] Specifically, the first encoded message is binary processed to obtain the second encoded message. The binary processing process is a mature existing technology and will not be repeated here. In this embodiment, an MQTT topic = / mms / group / {groupId} is assigned to each group. When the terminal device is started, an MQTT communication subscription is performed. The MQTT topic is an identifier used to distinguish the message sending and receiving of different groups. If the user corresponding to the terminal device joins two groups groupId1 and groupId2, then it will subscribe to the two topics / mms / group / groupid1 and / mms / group / groupid2, thereby receiving online push messages. Each time the terminal device receives a message, it performs protobuf decoding, and then records the group consumption site groupid, seq locally. The second data protocol is the MQTT protocol, and the second encoded message is sent to the current online device according to the MQTT data protocol. The MQTT protocol in this embodiment is only used for online subscription distribution, and there is no persistent message. The biggest advantage is that it takes advantage of the simplicity of the MQTT communication message body and the transmission convenience, so that it only performs online distribution, so that the online gateway is not affected by the client pulling messages, thereby improving performance. For example, in the case of a machine with 4 CPUs and 8GB of memory, and each message size = 150 bytes, this embodiment can achieve a push capability of 160,000 queries per second (QPS), which is equivalent to one gateway processing a group of 160,000 people. Without considering external network interference, it can also ensure that everyone's messages can be received within 100ms. It should be noted that the gateway can be linearly expanded, and the message push performance = single grid push performance * number of machines. This embodiment is actually verified on four 4-CPU 8GB gateways. After actual measurement, the overall QPS can reach more than 640,000, which is consistent with the theory.

[0113] In the high-performance group messaging method based on instant messaging provided by this embodiment, the second data protocol is only responsible for online subscription distribution and has no persistent messages, which is conducive to the transmission of the second encoded message, so that the online gateway is not affected by the message pulling of new online devices, thereby improving system performance.

[0114] In a specific embodiment, a message from a target group is pushed to a large group of 10,000 members. The entire data processing process includes:

[0115] (1) Writing a message to the group message table (as shown in Table 1) only requires one piece of data and database overhead. The online module delivers the message to the MQTT communication gateway, which uses the group ID of each client device to identify the currently online device. This is delivered directly over the network. This entire online push process does not require additional pre-processing or database logic, such as creating a task for each user. This makes it highly efficient and unaffected by offline users. Furthermore, it is highly compatible with dynamic group member additions.

[0116] (2) After the client receives the group message, it records the seq of the received message.

[0117] (3) After the offline client comes online, the local device receives the received message sequence last_seq from the newly online device and sends it to the target server. The target server sends all messages greater than the client's last_seq and less than or equal to group_msg_seq to the client through the offline module based on the latest group_msg_seq of the target group.

[0118] This embodiment also provides a high-performance group messaging device based on instant messaging. This device is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0119] This embodiment provides a high-performance group messaging device based on instant messaging, such as Figure 7 Shown, including:

[0120] The group message acquisition module 701 is used to acquire the to-be-sent group message of the target group, determine the target server based on the to-be-sent group message, and store the to-be-sent group message in the target server.

[0121] The online device determining module 702 is configured to determine the current offline device and the current online device according to the current connected device of the target server.

[0122] The online sending module 703 is configured to determine an online gateway based on the group identifier of the target group, and send the to-be-sent group message to the current online device based on the online gateway.

[0123] In some optional implementations, the high-performance group messaging device based on instant messaging further includes:

[0124] The new online device request pull module 704 is used to obtain a group message query request from the new online device when detecting that the current offline device is back online.

[0125] The group offline message determination module 705 is used to determine whether there is a group offline message in the target server according to the group message query request, and the group offline message is stored in the buffer of the target server.

[0126] The offline push module 706 is configured to push the group offline message to the corresponding newly online device through the offline gateway if there is a group offline message in the target server.

[0127] In some optional implementations, the online device determination module 702 includes:

[0128] The connection confirmation unit is used to obtain the group member tags of the target group and determine the online group members currently connected to the target server and the offline group members not connected to the target server according to the group member tags.

[0129] The online and offline confirmation unit is used to set the device corresponding to the online group member as the current online device and the device corresponding to the offline group member as the current offline device.

[0130] In some optional implementations, the online sending module 703 includes:

[0131] The structured coding unit is used to perform structured coding on the to-be-sent group message according to the first data protocol to obtain a first coded message.

[0132] The message sending unit is used to perform binary processing on the first coded message to obtain a second coded message, and send the second coded message to the current online device according to the second data protocol.

[0133] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0134] The high-performance group messaging device based on instant messaging in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0135] The embodiment of the present invention also provides a computer device having the above Figure 7 The high-performance group messaging device based on instant messaging is shown.

[0136] See also Figure 8 , Figure 8 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 8As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0137] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0138] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0139] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0140] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0141] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0142] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0143] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A high-performance group messaging method based on instant messaging, characterized in that: The method comprises: Obtaining a to-be-sent group message of a target group, determining a target server based on the to-be-sent group message, and storing the to-be-sent group message in the target server; Determine the current offline device and the current online device based on the current connected device of the target server; An online gateway is determined based on the group identifier of the target group, and the to-be-sent group message is sent to a current online device based on the online gateway.

2. The method according to claim 1, characterized in that The method further comprises: When it is detected that the currently offline device is back online, a group message query request is obtained from the newly online device; determining whether there is a group offline message in the target server according to the group message query request, wherein the group offline message is stored in a buffer of the target server; If there is a group offline message in the target server, the group offline message is pushed to the corresponding newly online device through the offline gateway.

3. The method according to claim 2, characterized in that The group message query request of the newly online device includes a user-group relationship identifier, and determining whether there is a group offline message in the target server according to the group message query request includes: Determine, based on the user-group relationship identifier, a message sequence identifier received by the group to be queried and the newly online device; Determine the offline messages of the group to be queried and the message sequence identifiers corresponding to the offline messages in the target server based on the group to be queried, and determine whether there are group offline messages based on the message sequence identifiers received by the newly online device and the message sequence identifiers corresponding to the offline messages. The group offline messages are offline messages that have not been received by the newly online device.

4. The method according to claim 3, characterized in that The determining whether there is a group offline message according to the message sequence identifier received by the newly online device and the message sequence identifier corresponding to the offline message includes: If the message sequence identifier received by the newly online device is smaller than the message sequence identifier corresponding to the offline message, then a group offline message exists; If the message sequence identifier received by the newly online device is equal to the message sequence identifier corresponding to the offline message, then there is no group offline message.

5. The method according to claim 3, characterized in that The process of determining the message sequence identifier includes: Obtaining a message identifier and a corresponding timestamp of a message to be sent to a group, wherein the message identifier is a non-natural sequence self-increment identifier; The message identifiers are arranged in chronological order according to the timestamps, and the arranged message identifiers are sequentially numbered to obtain a message sequence identifier, where the message sequence identifier is a natural sequence self-incrementing identifier.

6. The method according to claim 1, characterized in that Determine the current offline device and the current online device based on the current connected device of the target server, including: Obtaining group member tags of the target group, and determining online group members currently connected to the target server and offline group members not connected to the target server based on the group member tags; The device corresponding to the online group member is used as the current online device, and the device corresponding to the offline group member is used as the current offline device.

7. The method according to claim 1, characterized in that Sending the to-be-sent group message to the current online device based on the online gateway includes: Performing structured encoding on the to-be-sent group message according to a first data protocol to obtain a first encoded message; The first coded message is binary-processed to obtain a second coded message, and the second coded message is sent to the current online device according to a second data protocol.

8. A high-performance group messaging device based on instant messaging, characterized in that: The device comprises: A group message acquisition module is used to acquire a to-be-sent group message of a target group, determine a target server based on the to-be-sent group message, and store the to-be-sent group message in the target server; An online device determination module is used to determine the current offline device and the current online device according to the current connected device of the target server; The online sending module is used to determine an online gateway based on the group identifier of the target group, and send the to-be-sent group message to the current online device based on the online gateway.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Group message pushing method and device, computer device and storage medium

    CN112671636A

  • Real-time high-concurrency instant messaging method and device based on MQTT protocol and medium

    CN117880232A

  • Message push method, apparatus, device and medium

    US20220303347A1