Message processing method and instant messaging system
By introducing predefined interfaces and processing pipelines from external task systems, the reliability and stability issues of instant messaging systems when business rules are dynamically expanded are resolved, enabling flexible configuration of task rules and reliable message delivery.
Patent Information
- Application Number
- CN202511194121.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-11-11
AI Technical Summary
Existing instant messaging systems struggle to balance high reliability of message transmission and system stability when faced with dynamic expansion of business rules, leading to frequent modifications to core message processing flows and impacting user experience.
By introducing a predefined interface from an external task system, and through a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit, task rules are adjusted independently of the message transmission link to ensure that messages are accurately delivered to the recipient.
It enables flexible configuration of task rules and reliable message delivery, avoids intrusive modifications to the core message transmission link, and improves system stability and user experience.
Smart Images

Figure CN120935137A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a message processing method and an instant messaging system. Background Technology
[0002] With the widespread application of instant messaging systems in social networking, enterprise collaboration, and other fields, they need to simultaneously address the requirements of highly reliable transmission of massive amounts of messages, dynamic adaptation of business rules, and security protection. Traditional architectures often employ a single-coupled design, which leads to frequent modifications to the core message processing flow when the system expands its business functions. This affects the stability of message transmission and makes it difficult to flexibly respond to diverse business rule changes, creating a fundamental contradiction between business flexibility and system reliability.
[0003] The existing architecture struggles to balance dynamic expansion of business rules with high reliability of message transmission: when new business requirements such as message filtering and access control are added, the core message processing link needs to be modified intrusively, resulting in decreased system stability, increased message delivery delays, and the inability to guarantee message delivery in scenarios with frequent changes in business rules.
[0004] Therefore, there is an urgent need for an instant messaging system that can accommodate the expansion of business rules. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a message processing method. One or more embodiments of the present invention also relate to an instant messaging system, a message processing device, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0006] According to a first aspect of the present invention, a message processing method is provided, applied to a server of an instant messaging system, comprising: Receive pending messages sent by the initiator; The system calls the predefined interface of the external task system to execute the task processing rules for the message to be processed. The task processing rules are the strategies for controlling the message through the predefined external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into standard formats, and the path optimization unit is used to select the transmission path based on the network location of the receiver. Based on the receiver configuration information of at least one receiver, the processed message to be processed is sent to at least one receiver.
[0007] According to a second aspect of the present invention, an instant messaging system is provided, including a server and at least two clients, wherein the at least two clients include an initiator and at least one receiver; The initiator is responsible for responding to the message sending operation by generating a message to be processed and sending the message to be processed to the server. The receiver is used to respond to configuration operations, generate receiver configuration information, and send the receiver configuration information to the server. The server receives messages to be processed from the initiator; it calls predefined interfaces of an external task system to execute task processing rules on the messages to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline consisting of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into a standard format, and the path optimization unit is used to select a transmission path based on the network location of the receiver. Based on the receiver configuration information of at least one receiver, the processed message to be processed is sent to at least one receiver.
[0008] According to a third aspect of the present invention, a message processing apparatus is provided, comprising: The receiving module is configured to receive pending messages sent by the initiator; The processing module is configured to call the predefined interface of the external task system to execute task processing rules on the message to be processed. The task processing rules are strategies for controlling the message through the predefined external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into standard formats, and the path optimization unit is used to select the transmission path based on the network location of the receiver. The sending module is configured to send the processed message to at least one recipient based on the recipient configuration information of at least one recipient.
[0009] According to a fourth aspect of the present invention, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the above-described message processing method.
[0010] According to a fifth aspect of the present invention, a computer-readable storage medium is provided that stores a computer program / instructions which, when executed by a processor, implement the steps of the message processing method described above.
[0011] According to a sixth aspect of the present invention, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described message processing method.
[0012] One embodiment of the present invention implements receiving a message to be processed sent by an initiator; calling a predefined interface of an external task system to execute task processing rules on the message to be processed, wherein the task processing rules are a strategy for controlling messages predefined by the external task system, and the task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into a standard format, and the path optimization unit is used to select a transmission path based on the network location of the receiver; based on the receiver configuration information of at least one receiver, the processed message to be processed is sent to the at least one receiver.
[0013] By introducing predefined interfaces from an external task system, effective isolation between task processing rules and message transmission processes is achieved. When the initiator sends a message to be processed, the system executes the control policy configured in the external task system by calling the predefined interface, making changes to task rules completely independent of the message transmission link. A message delivery mechanism based on the receiver's configuration information ensures that processed messages are accurately delivered to the receiver. This allows modifications to task rules to be made only by adjusting the predefined policy in the external task system, without modifying the core message transmission code. This ensures both the reliability of message delivery and flexible configuration of task logic, effectively resolving the contradiction between task rule iteration and system stability in traditional architectures. Attached Figure Description
[0014] Figure 1 This is a flowchart of a message processing method provided in one embodiment of the present invention; Figure 2 This is a technical architecture diagram of a first instant messaging system provided in one embodiment of the present invention; Figure 3 This is a technical architecture diagram of a second instant messaging system provided in one embodiment of the present invention; Figure 4 This is a message architecture diagram of an instant messaging system provided in one embodiment of the present invention; Figure 5 This is a schematic diagram of the message uplink sending stage of an instant messaging system according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the message downlink transmission stage of an instant messaging system according to an embodiment of the present invention; Figure 7This is a schematic diagram of a security scheme for an instant messaging system provided in one embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of a message processing device provided in one embodiment of the present invention; Figure 9 This is a structural block diagram of a computing device provided in one embodiment of the present invention. Detailed Implementation
[0015] Numerous specific details are set forth in the following description to provide a full understanding of the invention. However, the invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0016] The terminology used in one or more embodiments of the present invention is for the purpose of describing particular embodiments only and is not intended to limit the scope of the invention. The singular forms “a,” “the,” and “the” used in one or more embodiments of the invention and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of the invention refers to and includes any or all possible combinations of one or more associated listed items.
[0017] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of the present invention, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of the present invention, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0018] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0019] First, the terminology used in one or more embodiments of the present invention will be explained.
[0020] IM stands for Instant Messaging. It refers to a communication method that allows users to send and receive text messages, files, voice messages, video messages, and other information in real time over the internet. It is widely used in social networking, office work, customer service, and other scenarios.
[0021] seq; short for sequence, meaning sequence or serial number. In the fields of computer science and communications, "seq" is usually used to represent the sequential number of a message, data packet, or operation, to ensure data ordering, deduplication, and consistency.
[0022] With the widespread application of instant messaging systems in social networking, enterprise collaboration, and other fields, their application scenarios are becoming increasingly diverse and complex. Users' demands for high reliability in message transmission, dynamic adaptation to business rules, and security protection are also rising. To meet these demands, modern instant messaging systems not only need to support concurrent access from massive numbers of users but also need to possess high flexibility to adapt to constantly changing business scenarios. However, traditional instant messaging architectures often employ a single-coupling design. While this design can meet basic message transmission needs, it falls short when faced with complex business logic.
[0023] Current instant messaging architectures struggle to simultaneously accommodate the dynamic expansion of business rules and the high reliability of message transmission. When new business functions such as message filtering and access control need to be added, it typically requires intrusive modifications to the core message processing flow. This not only increases system maintenance costs but may also lead to decreased stability of existing services and increased message delivery delays. Furthermore, due to the lack of effective external task processing mechanisms, frequent changes to business rules are difficult to respond to in a timely manner, thus impacting user experience.
[0024] This invention provides a message processing method, and also relates to an instant messaging system, a message processing device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0025] See Figure 1 , Figure 1 A flowchart of a message processing method according to an embodiment of the present invention is shown, which specifically includes the following steps.
[0026] Step 102: Receive the pending message sent by the initiator.
[0027] In this context, the initiator refers to the client entity that generates the message and sends it to the server, while the message to be processed refers to the message content generated by the initiator that needs to go through a series of processing steps before it can be finally delivered to the recipient.
[0028] In practical applications, the first step is to ensure that the communication connection between the initiator and the server is established and available. This typically involves using security protocols such as WSS (WebSocket Secure) or HTTPS to guarantee the security of data transmission. When a user triggers a message sending operation through the initiator's client, the system captures the operation and creates a pending message based on the selected message type and format. This message may contain various data formats such as text, images, and videos, along with metadata such as sending timestamps and message IDs. Subsequently, the initiator encapsulates this pending message into a data packet conforming to a predefined interface specification and transmits it to the server over the network. To ensure that messages are delivered to the server accurately, the system can employ various mechanisms to enhance reliability, such as setting up retransmission mechanisms to handle potential network fluctuations or packet loss. For the message sending part of the steps, one option is to directly utilize existing instant messaging protocols for transmission; another option is to temporarily store the message in a local cache and send it only after confirming that the network conditions are good. This approach can reduce the risk of message loss due to network instability to some extent.
[0029] In one specific embodiment of the present invention, it is assumed that the initiator is a mobile application, and a user enters a text message through the application and clicks the send button. The application first checks whether the current network environment supports message sending. If the network is normal, it packages the text content and its related metadata (such as message ID, sending time, etc.) into a JSON object. Then, the application sends this JSON object to the server via an encrypted WebSocket connection. During this process, if a network quality degradation or connection interruption is detected, the application automatically enables a reconnection mechanism and attempts to resend the undelivered message until a successful response is received from the server.
[0030] Step 104: Call the predefined interface of the external task system to execute the task processing rules for the message to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into standard formats, and the path optimization unit is used to select a transmission path based on the network location of the receiver.
[0031] The external task system refers to a third-party service or module independent of the core message transmission process. It implements various message processing strategies by providing predefined interfaces. Messages awaiting processing are message contents that have been initially collected but not yet fully processed. Task processing rules are a series of control strategies pre-defined by the external task system based on business needs, guiding how to process messages awaiting processing. The semantic analysis unit is responsible for detecting risks in the message content, such as whether it contains sensitive information or inappropriate remarks; the format conversion unit ensures that messages from different sources can be converted into a unified standard format for subsequent processing and storage; and the path optimization unit selects the optimal data transmission path based on the receiver's actual network location to improve message transmission efficiency.
[0032] In practical applications, when the server receives a message to be processed, it first calls a predefined interface of the external task system to initiate the task processing flow for that message. This process typically includes initializing the communication connection with the external task system and sending necessary authentication information to ensure security and authorization verification. Next, the message enters a pipeline composed of multiple processing units for processing. First, the semantic analysis unit uses natural language processing technology to analyze the message content and assess its potential risk level. If high-risk content is found, it may trigger further security checks or directly mark it as requiring manual review. Subsequently, the format conversion unit intervenes, identifying the message's original format and converting it to a standard format supported by the system, such as JSON or XML, ensuring that all messages can be consistently parsed and processed. Finally, the path optimization unit calculates the optimal transmission path based on the receiver's current network status and geographical location information, thereby reducing latency and improving the message delivery success rate. For the format conversion part of the steps, one option is to use existing message format conversion tools or libraries to perform the conversion operation; another option is to develop customized conversion logic specifically optimized for specific types of message formats, which can better meet the needs of specific business scenarios.
[0033] In one specific embodiment of the present invention, it is assumed that the server receives a message from the initiator, which contains multimedia content (such as images and text). The server first establishes a secure connection with the external task system via the HTTPS protocol and sends a message ID and authentication token. After receiving the request, the external task system begins semantic analysis to check whether the text portion of the message contains any content that violates community guidelines. Once confirmed to be error-free, the system continues to run the format conversion unit, converting the images from JPEG format to PNG format, and simultaneously encoding all text content into UTF-8 format. Afterwards, the path optimization unit queries the recipient's network status and learns that the recipient is currently located on the company's internal network, therefore deciding to use a fast channel within the local area network for message transmission. Throughout the process, the external task system continuously reports the processing progress to the server until all processing steps are completed and the final result is returned.
[0034] Furthermore, calling the predefined interface of the external task system includes: establishing bidirectional communication with the external task system through standard communication protocols; verifying the integrity and version identifier of the policy update instruction upon receiving it; and dynamically adjusting the interface call parameters based on the execution results returned by the external task system.
[0035] External task systems refer to third-party services or modules independent of the core message transmission process, which implement various message processing strategies by providing predefined interfaces. Standard communication protocols typically include HTTPS, RESTful APIs, or gRPC to ensure data security and compatibility. Policy update instructions are notifications or commands issued by external task systems regarding updates to processing strategies; their integrity and version identifiers are used to verify the authenticity and applicability of the instructions.
[0036] In practical applications, when it is necessary to call a predefined interface of an external task system, a bidirectional communication connection is first established with the external task system via a standard communication protocol (such as HTTPS or gRPC). This process involves initializing a secure connection, sending authentication information to ensure the legitimacy of both parties' identities, and negotiating communication parameters to ensure smooth subsequent interactions. Once the connection is successfully established, the system periodically checks for new policy update instructions. If such an instruction is received, the system will first verify its integrity and version identifier to ensure that the instruction has not been tampered with and is applicable to the current environment. Verification steps may include checking digital signatures, verifying hash values, and comparing version numbers. After verification, the system dynamically adjusts the interface call parameters based on the execution results returned by the external task system. For example, if a new policy requires the addition of certain specific message filtering rules, the system will add the corresponding parameters when calling the interface; if the policy requires a change in the message priority evaluation method, the system will modify the weight allocation parameters accordingly. For the bidirectional communication part of the steps, one option is to use the WebSocket protocol to maintain a long connection and receive feedback from the external task system in real time; another option is to use a polling mechanism to periodically query the status changes of the external task system. Although this method is not as efficient as a long connection, it is still a feasible choice in some resource-constrained scenarios.
[0037] In one specific embodiment of the present invention, it is assumed that the server is processing a message from the initiator and is preparing to call a predefined interface of an external task system for further processing. The server first establishes a secure connection with the external task system via HTTPS, sending a request containing authentication information and initial configuration. After confirming the request's legitimacy, the external task system begins executing a series of processing operations. During this period, the external task system issues a new policy update instruction, instructing the system to add filtering functionality for sensitive words. Upon receiving this instruction, the server first verifies its digital signature and version number. After confirming that everything is correct, it adjusts the interface call parameters according to the new policy requirements, adding sensitive word filtering configuration to subsequent calls. Simultaneously, to ensure continuous bidirectional communication, the system uses the WebSocket protocol to maintain a long connection with the external task system, receiving processing results in real time and dynamically adjusting subsequent operations based on these results.
[0038] Based on this, through a two-way communication mechanism, the system can obtain the latest processing results in real time and make optimal decisions accordingly, further improving the overall service quality and user experience.
[0039] Step 106: Based on the receiver configuration information of at least one receiver, send the processed message to at least one receiver.
[0040] Here, receiver configuration information refers to the message receiving preferences and parameter settings set by each receiver according to its own needs, including but not limited to message format, notification method, priority, etc. Processed pending messages refer to the message content that has undergone a series of processing steps such as semantic analysis, format conversion, and path optimization, and is ready to be sent to the receiver.
[0041] In practical applications, after the server completes all necessary processing steps for the messages to be processed, the next step is to accurately send these messages according to the configuration information of each recipient. First, the system reads the relevant recipient's configuration information from the database or cache. These configurations may involve details such as message display format (e.g., plain text, rich text), push notification type (e.g., sound alert, vibration alert), and whether encrypted transmission is required. Based on this configuration information, the system customizes the processed messages. For example, if a recipient prefers to receive compressed image messages, the system will perform the corresponding compression operation on the image before sending; if another recipient requires all messages to be encrypted, the system will encrypt the message before sending. Next, the system selects an appropriate transmission mechanism based on the recipient's current online status: for online recipients, messages can be pushed directly via WebSocket or other real-time communication protocols; while for offline recipients, it may be necessary to use a third-party push service or temporarily store the message on a server for the recipient to retrieve upon coming online. Furthermore, the system also needs to consider the recipient's network conditions to ensure successful message delivery even under poor network conditions. For the message push part in the steps, one option is to use the existing instant messaging protocol for real-time push; another option is to temporarily store the message in the local cache when the recipient's network is detected to be unstable, and retry pushing after the network is detected to be restored. This approach can improve the success rate of message delivery and reduce the number of retries to some extent.
[0042] In one specific embodiment of the present invention, it is assumed that there are two receivers, A and B. Receiver A is configured to prefer receiving encrypted rich text messages, and its device is currently online. Receiver B, on the other hand, wants to receive uncompressed high-definition image messages, but is offline because it is in airplane mode. The server first reads the configuration information of the two receivers and then adjusts the processed messages accordingly. For receiver A, the system encrypts its rich text messages using the AES encryption algorithm and pushes them directly to A's client via a WebSocket connection. Meanwhile, since receiver B is offline, the system decides to first store the high-definition image messages in its dedicated message queue and plans to push these messages immediately after receiver B is detected to be online. Throughout the process, the system continuously monitors the status changes of the receivers and adjusts the message sending strategy according to the latest status.
[0043] Furthermore, before sending the processed message to the recipient, the process includes: storing the processed message in a hierarchical storage system based on the recipient's configuration information. The hierarchical storage system includes a first storage layer for storing real-time message identifiers and setting time-sensitive thresholds; a second storage layer for establishing a composite index based on recipient attributes and message characteristics; and a third storage layer for performing compression and block processing on the message content. Every first preset time period, the resource usage of the first storage layer is scanned. If the resource usage exceeds a preset threshold, the real-time message identifier is cleared according to message priority. Every second preset time period, an incremental update operation is performed on the composite index in the second storage layer. Every third preset time period, a cross-regional data backup operation is performed on the message content in the third storage layer.
[0044] The receiver configuration information refers to the message receiving preferences and parameter settings set by each receiver according to its own needs. The hierarchical storage system is a multi-layered storage architecture designed to optimize message storage and retrieval efficiency. The first storage layer is mainly used to store real-time message identifiers and set expiration thresholds to ensure that messages can be quickly accessed within their validity period. The second storage layer improves message query speed by establishing a combined index based on receiver attributes and message characteristics. The third storage layer is responsible for compressing and segmenting message content to save storage space and facilitate subsequent data backup and recovery.
[0045] In practical applications, before sending processed messages to the recipient, the system first stores these messages in a hierarchical storage system based on the recipient's configuration information. For each processed message, the system generates a unique real-time identifier and stores it in the first storage layer. The first storage layer uses efficient data structures (such as Redis) to store these identifiers and sets an expiration threshold (e.g., 5 minutes) for each message to promptly clean up expired data. Simultaneously, the system builds a composite index based on the recipient's attributes (such as user ID and device type) and message characteristics (such as message type and priority), and saves these indexes to the second storage layer (such as Elasticsearch). This allows subsequent queries to quickly locate specific message records. Next, the system compresses and segments the message content and stores the results in the third storage layer (such as HDFS). This process not only reduces storage usage but also facilitates cross-regional data backup. Every first preset time period (e.g., 1 hour), the system scans the resource usage of the first storage layer. If resource usage exceeds a preset threshold (e.g., 80%), the system will clear some real-time identifiers according to message priority, prioritizing the retention of identifiers for high-priority messages. Every second preset time period (e.g., 24 hours), the system performs an incremental update operation on the composite index in the second storage layer to ensure that the latest index information reflects the current message status. Every third preset time period (e.g., 7 days), the system performs a cross-region data backup operation on the message content in the third storage layer to ensure that data can be recovered even if a data center fails.
[0046] In one specific embodiment of the present invention, assume the system receives a processed multimedia message and prepares to send it to the recipient. First, the system generates a real-time identifier for this message and stores it in the first storage layer (Redis), setting a timeout threshold of 5 minutes. Then, the system constructs a composite index based on the recipient's user ID and message type, and saves the index information to the second storage layer (Elasticsearch). Next, the system compresses and segments the message content, and stores the processed results in the third storage layer (HDFS). During this process, the system checks the resource usage of the first storage layer every hour. If resource usage exceeds 80%, the system deletes some identifiers based on message priority, prioritizing the retention of identifiers for important messages. Every 24 hours, the system incrementally updates the composite index in the second storage layer to ensure that the latest index information accurately reflects the current message status. Every 7 days, the system performs a cross-region data backup operation on the message content in the third storage layer to ensure data security and reliability.
[0047] Based on this, the overall performance and service quality of the system have been further improved through regular maintenance and optimization of the storage layer.
[0048] Further, sending the processed message to at least one recipient includes: detecting the network connection status of at least one recipient; if at least one recipient is online, parsing the priority identifier of the processed message; and selecting the corresponding real-time transmission protocol to push the processed message and checksum according to the priority identifier, wherein the checksum is generated based on the message content and is used to verify the acknowledgment response of at least one recipient.
[0049] The receiver's network connection status refers to whether each receiver is currently online and its network conditions (such as latency and bandwidth). The processed message to be processed refers to the message content that has undergone a series of processing steps (such as semantic analysis, format conversion, and path optimization) and is ready to be sent to the receiver. Priority identifiers are used to distinguish the importance and urgency of different messages so that the system can allocate resources reasonably for transmission. The checksum is verification information generated based on the message content, used to ensure that the message has not been tampered with during transmission, and guarantees the accuracy of message delivery through the receiver's confirmation response.
[0050] In practical applications, when a system is ready to send a processed message to at least one recipient, it first needs to check the network connectivity status of these recipients. This is typically achieved through a heartbeat mechanism or persistent connection technology, ensuring that the system can understand the online status and network quality of each recipient in real time. If at least one recipient is detected to be online, the system further parses the priority identifier in the processed message. The priority identifier can contain various attributes, such as high priority, normal priority, and low priority, each corresponding to a different real-time transmission protocol. For example, high-priority messages can be pushed in real time using the WebSocket protocol to ensure fast arrival; normal-priority messages can be pushed using the HTTP / 2 Server Push mechanism; and low-priority messages can use the QoS 1 level of the MQTT protocol to save resources and ensure eventual delivery. After selecting an appropriate transmission protocol based on the priority identifier, the system generates a checksum for each message. This checksum is calculated based on the message content (e.g., using MD5 or SHA-256 algorithms) and is pushed to the recipient along with the message. Upon receiving the message, the recipient must return an acknowledgment response containing the checksum. The system verifies the integrity and correctness of the message by comparing the checksum. For the real-time transmission protocol part of the steps, one option is to dynamically adjust the transmission protocol according to different network environments to adapt to different network conditions; another option is to predefine a fixed transmission protocol strategy and set a corresponding transmission scheme for each priority. This approach can simplify the complexity of the system to some extent.
[0051] In one specific embodiment of the present invention, assume the system receives a processed text message, ready to be sent to two recipients, A and B. The system first confirms that both recipients A and B are online using a heartbeat detection mechanism. Next, the system parses the message's priority identifier and finds it is marked as high priority. Based on this identifier, the system selects to use the WebSocket protocol for real-time push and generates a checksum based on the SHA-256 algorithm for this message. Subsequently, the system pushes this message along with the checksum to recipients A and B. After receiving the message, recipients A and B calculate their local checksums and compare them with the received checksum. If they match, they return an acknowledgment response to the system. Throughout the process, the system continuously monitors the network status of the recipients to ensure successful message delivery even under network fluctuations.
[0052] Based on this, by introducing a verification code mechanism, the integrity and accuracy of data during message transmission are further improved, ensuring that messages are not lost or tampered with during transmission.
[0053] Furthermore, after selecting the corresponding real-time transmission protocol to push the processed message and verification code according to the priority identifier, the method also includes: in the event of real-time push failure, retrieving the complete message content from the second storage layer, wherein the second storage layer is used to establish a joint index based on the receiver attributes and message characteristics; calling the message relay service to reassemble the processed message based on a predetermined format; retrying the push at a preset interval, and detecting the network connection status of at least one receiver before retrying.
[0054] Real-time push failure refers to the state where an attempt to push a message via a selected real-time transport protocol (such as WebSocket, HTTP / 2, etc.) fails. The second storage layer is used to build a combined index based on receiver attributes and message characteristics, and to store the processed message content. The message relay service is the service module responsible for reassembling and resending messages, ensuring that messages are delivered correctly. The pre-set interval retry push mechanism aims to periodically attempt to resend messages until successful or the maximum number of retries is reached.
[0055] In practical applications, after the system selects the corresponding real-time transmission protocol based on the priority identifier to push the processed message and verification code, if the real-time push fails, a subsequent message recovery process is initiated. First, the system extracts the complete message content from the second storage layer. The second storage layer uses efficient data structures (such as Elasticsearch) to store a composite index built based on receiver attributes and message characteristics, ensuring rapid location and extraction of the required message content. Next, the system calls a message relay service to reassemble the extracted message. The reassembly process includes parsing the original message data, restoring its format, and regenerating necessary metadata (such as timestamps and priority identifiers). Furthermore, the message relay service can adjust the message transmission parameters based on the current network conditions to improve the success rate of retry pushes. Subsequently, the system retryes the push at preset time intervals. Before each retry, the system checks the network connection status of at least one receiver. For example, if the receiver's network is detected to be normal, the optimized transmission parameters are immediately used for pushing; if the network is still unstable, the system waits for the next retry cycle before attempting again. For the retry push part of the steps, one option is to use the exponential backoff algorithm to set the retry interval, gradually increasing the time interval between each retry to avoid frequent retries and wasting resources when the network is abnormal; another option is to dynamically adjust the retry strategy based on historical push records and formulate personalized retry schemes for the network characteristics of different recipients. This approach can improve the retry success rate to a certain extent.
[0056] In one specific embodiment of the present invention, suppose the system prepares to push a high-priority message to receiver A, but the initial real-time push via the WebSocket protocol fails. The system first extracts the complete content of the message from the second storage layer (Elasticsearch) and quickly locates the relevant record using a composite index. Next, the system calls a message relay service to reassemble the message, including restoring its original format and regenerating the priority identifier and timestamp. Then, the system begins to attempt to push the message according to a preset retry interval. Before the first retry, the system detects that receiver A's network connection is unstable and decides to try again later. After several retry intervals, the system detects that receiver A's network has returned to normal. At this point, the system adjusts the transmission parameters and immediately initiates the next push attempt. Finally, after multiple retries, the message is successfully delivered to receiver A, and an acknowledgment response containing a checksum is received.
[0057] Based on this, through an intelligent retry mechanism, the system can maximize the use of network resources, reduce unnecessary retries, and improve overall performance and service levels.
[0058] Furthermore, after selecting the corresponding real-time transmission protocol to push the processed message and verification code according to the priority identifier, the method also includes: obtaining the complete message content from the third storage layer when the recipient is offline, wherein the third storage layer is used to perform compression and block processing on the message content; calling a third-party service to generate offline notification content based on the complete message content and push it offline; and clearing the complete message content from the third storage layer when the offline notification content is successfully pushed offline.
[0059] In this context, "recipient offline" refers to the recipient not currently connected to the network or not in a state where they can receive messages. The third storage layer is used to compress and segment the message content to save storage space and facilitate subsequent data backup and recovery. Offline notification content refers to notification information generated based on the complete message content, pushed through third-party services (such as Apple Push Notification Service (APNs) or Firebase Cloud Messaging (FCM)) to ensure that the recipient receives the notification even if they are offline.
[0060] In practical applications, after the system selects the corresponding real-time transmission protocol based on priority identifiers to push processed messages and verification codes, if the recipient is detected to be offline, the offline message processing flow is initiated. First, the system retrieves the complete message content from the third storage layer. The third storage layer typically uses a distributed file system (such as HDFS) to store compressed and chunked message data, ensuring efficient access and management. Next, the system calls a third-party service (such as APNs or FCM) to generate offline notification content based on the complete message content. The generated offline notification content may include a message digest, sender information, and necessary prompts, and will be adapted according to the recipient's device type. For example, for mobile devices, a push notification containing rich media content can be generated; for web devices, a ServiceWorker mechanism can be used for pushing. Subsequently, the system uses the third-party service for offline push, ensuring that the notification is successfully delivered to the recipient's device. Once the offline notification content is successfully pushed, the system clears the complete message content from the third storage layer, releasing storage resources. Furthermore, to ensure data security and integrity, the system may perform a verification operation before clearing the message to ensure that the offline push was indeed successfully completed. For the offline notification generation part of the steps, one option is to use a predefined template to generate standardized notification content; another option is to dynamically adjust the notification format according to the recipient's preferences to provide a more personalized user experience.
[0061] In one specific embodiment of the present invention, suppose the system prepares to push a message of normal priority to recipient B, but detects that recipient B is currently offline. The system first extracts the complete message content from the third-level storage layer (HDFS), including compressed and segmented data. Next, the system calls a third-party push service (such as FCM) to generate an offline notification based on the complete message content. The generated notification includes a message digest, the sender's name, and a brief prompt. The system sends this offline notification to recipient B's device via FCM. After successfully receiving a push confirmation, the system removes the complete message content from the third-level storage layer, releasing storage resources. Throughout the process, the system also records the push timestamp and result for subsequent auditing and analysis.
[0062] Based on this, the intelligent offline push mechanism minimizes storage overhead and improves overall performance and service levels. Simultaneously, by periodically cleaning up successfully pushed message content, the utilization of storage resources is further optimized, ensuring the long-term stability of the system.
[0063] Furthermore, sending the processed message to at least one recipient includes: when at least one recipient is online through multiple terminals, sending the processed message to all online terminal devices in parallel; when the target terminal performs a state change operation on the processed message, broadcasting the state value corresponding to the state change operation to other online terminals, wherein the target terminal is any one of the multiple terminals.
[0064] In this context, "recipient online across multiple terminals" refers to the same user simultaneously logging in and remaining online on different devices (such as mobile phones, tablets, and desktop computers). "Processed pending message" refers to the message content that has undergone a series of processing steps (such as semantic analysis, format conversion, and path optimization) and is ready to be sent to the recipient. "State change operation" refers to the actions performed on the message by the recipient on a particular terminal (such as "read," "deleted," or "marked"), and these operations need to be synchronized to other online terminals.
[0065] In practical applications, when the system is ready to send a processed message to at least one recipient, it first checks whether the recipient is online through multiple terminals. If the check shows that the recipient is indeed online through multiple terminals, the system will send the processed message to all online terminal devices in parallel. This means that each message will be pushed to every online device of the user simultaneously, ensuring that the user can view the latest messages instantly on any device. For example, if a user is logged into the same account on both a mobile phone and a tablet and is online, the system will display new messages on both devices simultaneously.
[0066] Next, when a state change operation is performed on the processed message on the target terminal (i.e., any one of multiple terminals), the system will broadcast the corresponding state value to other online terminals. State change operations can include, but are not limited to, marking a message as read, deleting it, or marking it as important. For example, when a user marks a message as "read" on their phone, the system will capture this operation and immediately broadcast the "read" status value to the user's other online devices (such as tablets and desktop computers). This way, the user will also see the message marked as "read" on other devices, thus maintaining a consistent user experience.
[0067] For the multi-terminal synchronization part of the steps, one option is to use a real-time push mechanism (such as WebSocket) to broadcast state changes instantly; another option is to use a polling mechanism to periodically check the state changes of each terminal and synchronize updates when changes are detected. However, real-time push mechanisms generally offer faster response times and a better user experience, and are therefore the preferred solution in most cases.
[0068] In one specific embodiment of the present invention, assume that user A logs into an instant messaging system simultaneously via a mobile phone and a desktop computer, and both devices are online. After receiving a message from the initiator, the system immediately pushes the message to both user A's mobile phone and desktop computer in parallel. At this time, user A views and marks the message as "read" on their mobile phone. Upon capturing this action, the system immediately broadcasts the "read" status value to the user's desktop computer via a WebSocket connection. As a result, user A also sees the message marked as "read" on their desktop computer, ensuring a consistent experience across multiple terminals.
[0069] Based on this, the system can minimize data inconsistencies and improve overall performance and service levels through an intelligent multi-terminal synchronization mechanism. At the same time, real-time broadcasting of status change information further optimizes the user experience and ensures the long-term stability of the system.
[0070] In this embodiment of the invention, by introducing a predefined interface from an external task system, effective isolation between task processing rules and message transmission flow is achieved. When the initiator sends a message to be processed, the system executes the control strategy configured by the external task system by calling the predefined interface, making changes to task rules completely independent of the message transmission link. A message delivery mechanism based on the receiver's configuration information ensures that processed messages are accurately delivered to the receiver. This allows modifications to task rules to be made only by adjusting the predefined strategy in the external task system, without modifying the core message transmission code. This ensures both the reliability of message delivery and flexible configuration of task logic, effectively resolving the contradiction between task rule iteration and system stability in traditional architectures.
[0071] One embodiment of the present invention provides an instant messaging system, including a server and at least two clients, the at least two clients including an initiator and at least one receiver; the initiator is used to generate a message to be processed in response to a message sending operation and send the message to be processed to the server; the receiver is used to generate receiver configuration information in response to a configuration operation and send the receiver configuration information to the server; the server is used to receive the message to be processed sent by the initiator; call a predefined interface of an external task system to execute task processing rules on the message to be processed, wherein the task processing rules are strategies for controlling messages predefined by the external task system, and the task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit, wherein the semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into a standard format, and the path optimization unit is used to select a transmission path based on the receiver's network location; based on the receiver configuration information of at least one receiver, the processed message to be processed is sent to at least one receiver.
[0072] This design, applied to the instant messaging system, decouples task processing rules from message transmission flow by introducing a predefined interface from an external task system on the server side, thus separating business logic from the core communication link. The initiator is responsible for generating and sending messages to be processed. The receiver defines personalized receiving strategies (such as message format preferences and push methods) through configuration operations and uploads the configuration information to the server. The server, acting as the core coordinator, receives messages and invokes the external task system to perform content risk detection, format standardization, and path optimization. Simultaneously, it makes message routing and delivery decisions based on the receiver's configuration information. This design ensures that changes to task rules only require adjustments to the strategy within the external task system, without modifying the main message transmission flow on the server side. This guarantees message delivery and system stability while improving the flexibility and maintainability of business logic, effectively resolving the contradiction between functional expansion and system reliability in traditional architectures.
[0073] See Figure 2 As shown, Figure 2 This is a technical architecture diagram of a first instant messaging system provided in an embodiment of the present invention. Firstly, regarding... Figure 2 Explain the elements in: iOS: A mobile device operating system.
[0074] Android: A mobile device operating system.
[0075] React Native is a framework for building cross-platform mobile applications.
[0076] Flutter is a UI framework for building cross-platform applications.
[0077] Unity is a real-time 3D interactive content creation and operation platform.
[0078] JS stands for JavaScript, which is the JavaScript scripting language.
[0079] Docker: Docker is an open-source application container engine.
[0080] Prometheus is an open-source system monitoring and alerting toolkit.
[0081] Grafana is an open-source visualization and analytics platform.
[0082] Kubernetes: The full name is K8s (the middle 8 letters are omitted), which is an open source platform for automatically deploying, scaling and managing containerized applications. It enables efficient management of container clusters and ensures reliable application operation.
[0083] Etcd (zookeeper consul): Etcd is a distributed key-value store system used for shared configurations, service discovery, etc., ensuring data consistency and high availability in distributed systems.
[0084] Zookeeper is a distributed, open-source distributed application coordination service that provides functions such as configuration maintenance, naming service, and distributed synchronization to assist distributed systems in running normally.
[0085] Consul is a service mesh solution for service discovery, configuration management, and segmentation, helping to build and manage inter-service communication in distributed systems.
[0086] Linux / Mac / Win: These are three mainstream operating systems.
[0087] Webhooks are HTTP-based callback mechanisms that automatically send HTTP requests to pre-defined URLs when a specific event occurs, enabling event-driven interaction between different systems.
[0088] RESTful API: Representational State Transfer API is an architectural style for designing web services. It enables data interaction and operations between different systems through standard HTTP methods (such as GET, POST, etc.), making system integration more standardized and convenient.
[0089] AWS S3 stands for Amazon Web Services Simple Storage Service, a cloud storage service used to store and retrieve any type of data, such as images, documents, and videos, enabling secure storage and flexible access to data.
[0090] Firebase is a platform that provides a variety of backend services, including real-time databases, authentication, cloud functions, and storage, helping developers quickly build and operate applications without having to worry too much about backend infrastructure setup.
[0091] API stands for Application Programming Interface. It is an interface for interaction between different software components. It defines the specifications and methods of data interaction, allowing different systems or functional modules to communicate with each other and call functions.
[0092] Msg Gateway (proxy): A message gateway (proxy) is used to receive, forward, and process messages. It can perform message routing and protocol conversion between different clients and servers, ensuring reliable message transmission.
[0093] Third party: Generally refers to external services or components that are not developed by this system and are used to supplement the system's functions, such as accessing third-party login, payment, map and other services.
[0094] User Service: User service is used to manage user-related business logic, such as user registration, login, information modification, and permission management, ensuring the orderly identity and usage process of users in the system.
[0095] Friend & Group service: This service is responsible for handling functions such as friend relationship establishment and deletion, group creation, member management, and group chat logic, supporting social relationships and interaction scenarios in social applications.
[0096] Notification Service: This service is used to push various notifications to users, such as system messages, business reminders, and interactive notifications. It can reach users through different channels (such as in-app notifications, emails, push notifications, etc.).
[0097] AccountService: Account services primarily manage user account-related matters, including account creation, cancellation, fund (if any) management, account security settings, etc., ensuring the stability of the account system and the security of user assets (in a broad sense).
[0098] im-push: can be understood as an instant messaging push service, used in instant messaging scenarios to push messages and other content to target users or devices, ensuring that messages reach the recipient in a timely manner.
[0099] im-auth: Instant messaging authentication service, responsible for identity authentication during instant messaging, ensuring the legitimacy of users or devices participating in the communication and guaranteeing communication security.
[0100] im-user: Instant messaging user service, focusing on user-related business in instant messaging scenarios, such as user status management and personalized settings association in instant messaging.
[0101] im-msg: Instant messaging service that handles the core logic of sending, receiving, storing, and formatting messages in instant messaging, ensuring the correct flow of messages during the communication process.
[0102] im-friend: An instant messaging friend service specifically designed for managing friend relationships within instant messaging, including operations such as adding, deleting, and maintaining friend lists.
[0103] im-group: An instant messaging group service used to manage groups in instant messaging, including group creation, disbanding, group member management, and group chat rule settings.
[0104] im-third: Instant messaging third-party services that connect to third-party functions or services related to instant messaging, such as integrating third-party emoji libraries and third-party voice recognition, to enrich instant messaging functionality.
[0105] Conversation: A conversation service that manages conversations in instant messaging or interactive scenarios, including conversation creation, conversation content storage, and conversation state maintenance (such as unread message count, conversation pinning, etc.), supporting the interactive communication process between users.
[0106] seq-manager: The sequence manager is used to generate and manage unique sequence identifiers. In scenarios where unique identifiers are required in data storage, message sorting, and business processes, it ensures the order and uniqueness of data, such as the orderly sending and receiving of messages.
[0107] Kafka is a high-throughput distributed stream processing platform, often used for scenarios such as real-time data feeds and large-scale logs. It can realize real-time data collection, transmission, storage and processing, and ensure data flow under high concurrency.
[0108] MQ: Short for MessageQueue, it is a middleware for passing messages between applications. It can achieve asynchronous communication, traffic shaping, and application decoupling, ensuring stable operation of the system under high concurrency or complex interaction scenarios.
[0109] im-msgtransfer: An instant messaging service focused on transmitting instant messaging messages between different modules, services, or terminals, ensuring that messages travel efficiently and accurately from sender to receiver.
[0110] Localcache: Local cache is a temporary data storage area stored locally (such as the server or device where the application resides). It is used to quickly retrieve frequently used data, reduce access to remote storage or services, and improve system response speed and performance.
[0111] Redis is an open-source in-memory data storage system commonly used as a database, cache, and message broker. Because the data is stored in memory, it enables high-speed read and write operations and is used to store frequently accessed data, session information, etc., thereby improving system performance.
[0112] MongoDB, short for MongoDB, is a distributed file storage database. It is a NoSQL database suitable for storing unstructured data such as documents and logs, and features high scalability and a flexible data model.
[0113] SQLite is a lightweight, embedded relational database that does not require a separate server process. It can be directly embedded into applications to store small amounts of structured data, such as local application configuration information and small business data. It is convenient, fast, and consumes few resources.
[0114] Figure 2 The technical architecture, layers, and components involved are as follows: The client-side layer supports multi-platform development. With the help of im-sdk-core, it is compatible with platforms such as iOS, Android, ReactNative, Flutter, Unity, and JS, providing a foundation for IM function development for different terminals.
[0115] The access layer serves as the entry point for interaction between the client and the server, through APIs, message gateway proxies (MsgGateway(proxy)), and third parties, handling request access and forwarding.
[0116] The service layer covers UserService, Friend&Groupservice, NotificationService, AccountService, as well as Ringkol series IM exclusive services such as im-push and im-auth, and provides support for core IM business logic, including conversation and seq-manager.
[0117] The middleware and communication layer utilizes Kafka and Message Queues (MQ) to achieve asynchronous communication and traffic shaping, ensures message transmission through im-msgtransfer, accelerates local caching with Localcache (Redis), and enables event-driven interaction between systems using webhooks.
[0118] The data storage layer uses MongoDB (a non-relational database) and SQLite (an embedded relational database) to store data, meeting different structured and unstructured data storage needs.
[0119] Infrastructure and monitoring rely on Docker for containerized deployment, Prometheus and Grafana for monitoring and visualization, Kubernetes for container orchestration and management, and Etcd / ZooKeeper and Consul for ensuring distributed system coordination. It supports multiple operating systems including Linux, Mac, and Windows. External interaction is achieved through RESTful APIs, and functionality is extended by combining AWS S3 (cloud storage) and Firebase (backend service platform).
[0120] See Figure 3 As shown, Figure 3 This is a technical architecture diagram of a second instant messaging system provided in one embodiment of the present invention, and the layers are as follows: The client and infrastructure layers consist of a client application that supports multiple platforms (iOS, Android, etc.) and relies on IM-SDK-API (Golang) and IM-SDK-Core (Golang). The former provides the client with access to the SDK interface, while the latter ensures the storage of user and group data and data consistency between the client and server, communicating with the server via HTTPS / DH. The client application server maintains its own user system, including user friend information and business logic modules.
[0121] The access and gateway layer, via NGINX / FS (DMZ) load balancer / reverse proxy, uses APIGateway (HTTP, websocket, TCP) as the external entry point for the IM server, supports long and short connection access, handles login requests, and combines HTTPS-TOKEN to ensure security.
[0122] The service layer includes business services: covering IM-Conversation (session creation / deletion / update), IM-Group (group and member management), IM-Friend (friend relationship management), IM-User (user information management), IM-Auth (user login authentication), IM-Org (organization and member management), and IM-File (file upload and management), each supporting corresponding business logic.
[0123] Message flow: IMMSG (message sending / receiving / synchronization / recall processing, etc.) connects to the message bus RocketMQ, using MQ to decouple services and smooth out peaks, ensuring no message loss; IM-Transfer (message persistence and forwarding) writes data to cache (seq, token, redis), unstructured (MongoDB), and structured (MongoDB encrypted) storage, and then forwards the message to IM-Push; IM-Push parses the message and forwards it to the recipient's login server for online push, if it fails, it calls IM-OfflinePush to use a third party for offline push.
[0124] Management and Expansion: OPENAPI allows direct connection to the management backend for sending messages and querying; shared services integrate ElasticSearch (retrieval), Zookeeper (registration), Skywalking (links), ELK (logs), Sentinel (circuit breaking and rate limiting), NTP (clock), IM-Admin (management backend), and IM-Lookup (to work with the registry center to maintain service node status and distribute requests), and connect to third-party cloud platforms to expand system capabilities.
[0125] See Figure 4 As shown, Figure 4 This is a message architecture diagram of an instant messaging system provided in one embodiment of the present invention. The data flow and functions of each module involved in its message architecture are as follows: In the case of online message sending (ClientA sends a message to ClientB and B is online): A connection is established. ClientA establishes a long connection with msg_gateway via WebSocket (since msg_gateway is the only entry and exit point for online message sending and receiving) and initiates the sending of a message to ClientB.
[0126] Message access: The Producer in msg_gateway receives the message, processes it through the Sender, and sends the message to the MQ, which stores it by partition.
[0127] Message consumption and forwarding: The transfer service subscribes to the MQ to continuously consume messages. First, it uses seqmgr to generate a seq-bound message from the Redisseq_token (the server associates messages through seq). Then, it caches the message in Redis and calls the push service. The push service parses the message to obtain ClientB and the server address that B is logged into. It forwards the message to the msg_gateway on the B side, which pushes it to ClientB. After ClientB confirms, it sends the message back to the msg_gateway to complete the online message loop.
[0128] In the case of offline message processing (ClientA sends a message to ClientB and B is offline): The message access process is the same as in the online scenario. The message is entered into the MQ via msg_gateway, consumed by transfer, and then the push attempt to push the message online fails.
[0129] The push function calls thirdpartyservices(push) (such as JPush, Apple Push, etc.) to push messages to ClientB offline.
[0130] Message synchronization and persistence are not distinguished: For persistence, after the message is cached and forwarded by transfer, the message is asynchronously persisted to mysqlpersistentmessage (the persistence action is asynchronous, ensuring the efficiency of the process); offline messages will be stored in MongoDBofflinemessages.
[0131] For message synchronization, on ClientB's side, msgsync accesses MongoDB and Redis to retrieve messages, filters and synchronizes messages by sequence number via msg_gateway, and synchronizes the sequence number locally on ClientB to ensure orderly message reception. If all messages are needed, msgsync directly retrieves all messages from B's storage for synchronization.
[0132] The entire architecture enables online sending and receiving of messages, offline push, persistent storage and synchronization through the collaboration of various modules, ensuring efficient, reliable and orderly message flow.
[0133] See Figure 5 As shown, Figure 5This is a schematic diagram of the message uplink sending stage of an instant messaging system according to an embodiment of the present invention. The client, as the message initiator, sends the message to the message gateway via HTTPS (corresponding to the HTTP protocol) or WSS (corresponding to the WebSocket protocol) as needed, thereby accessing the system and adapting to the application layer protocol requirements of different clients.
[0134] The message gateway relies on the ETCD cluster (used for RPC service registration and discovery) to initiate RPC requests to call the distributed key-value storage system to jointly process messages. After processing, the message flows to the message splitting unit, which then retrieves the original message from the application server, processes it, and puts it into the message queue. As long as the message is successfully placed into the MQ, it is considered to have been sent successfully. Its reliability is guaranteed by the MQ cluster. At the same time, the processing unit supports external call interfaces (business server HTTP interface), which can realize business control over messages (such as blocking, filtering, etc.).
[0135] In the message processing flow, the distributed key-value storage system confirms the result via RPC and sends it back to the message gateway. The message gateway then confirms the result via the gateway and sends the final result back to the client. Reliable data transmission during the message sending phase is ensured through ACK and clustered deployment.
[0136] See Figure 6 As shown, Figure 6 This is a schematic diagram of the message downlink sending stage of an instant messaging system according to an embodiment of the present invention. Messages flow out from the message queue via message transmission and enter the downlink process. In inbox mode, a message will add content to both the sender's and receiver's mailboxes: Redis stores the message sequence number (generating a unique, incremental seq for both the sender and receiver), MongoDB stores historical messages directly pulled by the user, and MySQL stores all roaming historical messages. Simultaneously, encrypted message storage is also handled to achieve message persistence.
[0137] After the message is asynchronously stored in the persistent layer, the push module is called via RPC. If the direct RPC call fails, the message is rolled back to the message queue for transfer, and delivery is guaranteed by the "RPC+MQ" bidirectional mechanism. After the push module receives the message, it attempts to push it to the client online via a distributed key-value storage system and a message gateway using WebSocket. If the online push fails, a third-party offline push is triggered to ensure message delivery.
[0138] The message push process involves two key confirmations: from message transmission to storage and push, the status is confirmed and fed back to the upstream via RPC; during online push, the success of the RPC request and confirmation is verified to build a reliable downlink message transmission closed loop, ensuring the integrity of the message transmission, storage and push process from the queue to the client.
[0139] See Figure 7 As shown, Figure 7 This is a schematic diagram of a security solution for an instant messaging system provided by an embodiment of the present invention, which constructs a protection system from multiple dimensions: Basic protection dimensions: Supplemented by "network protection support" and "security incidents," the core focus is on user, network, application, data, virtualization, and host security. User management and access control ensure identity trustworthiness through privileged user auditing, two-factor authentication, and login permission policies (preventing brute-force attacks and unauthorized access). Network security relies on internal and external network isolation, encrypted transmission (HTTPS, etc.), and firewalls to cover the communication network layer. Application security uses application firewalls, message watermarking, and sensitive word blocking to meet application content security needs (sensitive word filtering, file tracing, etc.). Data security implements hierarchical data storage, access auditing, and destruction through file watermarking, data auditing, and encryption (SM4). Virtualization and host security achieve process, file, and data isolation and system protection through application hardening, HyperVisor hardening, and server virus protection.
[0140] Emergency and Management Dimension: The left side, "Safety and Emergency," includes emergency plans and disaster recovery, while the right side corresponds to security information incident management and emergency response. Combined with security policy management, this creates a closed loop from incident monitoring to emergency response. At the same time, through security auditing (covering user operations and message content), actions such as login, sending and receiving messages, group operations, and chat data are verified to ensure that the entire process is traceable and risks are controllable.
[0141] Technical Implementation Dimensions: Each security module closely addresses the protection requirements for login permissions, system processes, data privacy, communication networks, and application content. For example, two-factor authentication and request frequency control address login security; process / file / data isolation and application hardening address system security; watermarking, traceless messaging, and storage encryption address data privacy; HTTPS, SRTP, and other protocol encryption address communication security; and sensitive word blocking and file tracing address application content security. Multiple technologies work together to ensure end-to-end security of the IM system.
[0142] Corresponding to the above method embodiments, the present invention also provides a message processing device embodiment. Figure 8 A schematic diagram of a message processing apparatus according to an embodiment of the present invention is shown. Figure 8 As shown, the device includes: The receiving module 802 is configured to receive pending messages sent by the initiator.
[0143] Processing module 804 is configured to call a predefined interface of an external task system to execute task processing rules on the message to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline consisting of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into a standard format, and the path optimization unit is used to select a transmission path based on the network location of the receiver.
[0144] Optionally, the processing module 804 is further configured to establish bidirectional communication with an external task system via a standard communication protocol; upon receiving a policy update instruction, verify the integrity and version identifier of the policy update instruction; and dynamically adjust the interface call parameters based on the execution results returned by the external task system.
[0145] The sending module 806 is configured to send the processed message to at least one recipient based on the recipient configuration information of at least one recipient.
[0146] Optionally, the message processing module also includes a storage module, configured to store processed messages to be processed in a hierarchical storage system based on receiver configuration information. The hierarchical storage system includes a first storage layer for storing real-time message identifiers and setting time-sensitive thresholds; a second storage layer for establishing a composite index based on receiver attributes and message characteristics; and a third storage layer for performing compression and block processing on the message content. Every first preset time period, the resource usage of the first storage layer is scanned. If the resource usage exceeds a preset threshold, the real-time message identifiers are cleared according to message priority. Every second preset time period, an incremental update operation is performed on the composite index in the second storage layer. Every third preset time period, a cross-regional data backup operation is performed on the message content in the third storage layer.
[0147] Optionally, the sending module 806 is further configured to detect the network connection status of at least one receiver; if at least one receiver is online, parse the priority identifier of the processed message to be processed; select the corresponding real-time transmission protocol according to the priority identifier to push the processed message to be processed and the check code, wherein the check code is generated based on the message content and is used to verify the acknowledgment response of at least one receiver.
[0148] Optionally, the sending module 806 is further configured to extract the complete message content from the second storage layer in the event of a real-time push failure, wherein the second storage layer is used to establish a joint index based on the receiver attributes and message characteristics; call the message relay service to reassemble the processed message to be processed based on a predetermined format; retry pushing at a preset interval, and detect the network connection status of at least one receiver before retrying.
[0149] Optionally, the sending module 806 is further configured to retrieve the complete message content from the third storage layer when the receiver is offline, wherein the third storage layer is used to perform compression and block processing on the message content; call a third-party service to generate offline notification content based on the complete message content and push it offline; and clear the complete message content in the third storage layer if the offline notification content is successfully pushed offline.
[0150] Optionally, the sending module 806 is further configured to send the processed message to be processed in parallel to all online terminal devices when at least one receiver is online through multiple terminals; and to broadcast the status value corresponding to the status change operation to other online terminals when the target terminal performs a status change operation on the processed message to be processed. The target terminal is any one of the multiple terminals.
[0151] In this message processing device, the receiving module 802 receives messages from the initiator, serving as the entry point for the entire message processing flow. The processing module 804 handles the core logic processing, executing a task processing pipeline consisting of semantic analysis, format conversion, and path optimization by calling predefined interfaces of an external task system. This enables functions such as message content risk detection, heterogeneous message standardization, and optimal transmission path selection. Simultaneously, the processing module 804 supports bidirectional communication with the external task system, possessing integrity verification and dynamic parameter adjustment capabilities during policy updates, ensuring that changes to task rules do not require modification of the main message transmission flow. Based on the receiver's configuration information, the system can accurately deliver messages after processing, thereby improving the flexibility and maintainability of task logic while ensuring message transmission reliability, effectively resolving the contradiction between functional expansion and system stability in traditional architectures.
[0152] The above is an illustrative scheme of a message processing device according to this embodiment. It should be noted that the technical solution of this message processing device and the technical solution of the message processing method described above belong to the same concept. For details not described in detail in the technical solution of the message processing device, please refer to the description of the technical solution of the message processing method described above.
[0153] Figure 9 A structural block diagram of a computing device 900 according to an embodiment of the present invention is shown. The components of the computing device 900 include, but are not limited to, a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.
[0154] The computing device 900 also includes an access device 940, which enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 940 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0155] In one embodiment of the present invention, the above-described components of the computing device 900 and Figure 9 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 9 The illustrated block diagram of the computing device is for illustrative purposes only and is not intended to limit the scope of the invention. Those skilled in the art can add or replace other components as needed.
[0156] The computing device 900 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 900 can also be a mobile or stationary server.
[0157] The processor 920 is used to execute the following computer program / instruction, which, when executed by the processor, implements the steps of the above message processing method.
[0158] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computing device embodiments are basically similar to the message processing method embodiments, so the description is relatively simple; relevant parts can be referred to in the description of the message processing method embodiments.
[0159] An embodiment of the present invention also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described message processing method.
[0160] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computer-readable storage medium embodiment is described simply because it is substantially similar to the message processing method embodiment; relevant parts can be referred to in the description of the message processing method embodiment.
[0161] An embodiment of the present invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the above-described message processing method.
[0162] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the message processing method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the message processing method described above.
[0163] The foregoing has described specific embodiments of the invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0164] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0165] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of the present invention.
[0166] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0167] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments of the present invention. These embodiments are selected and specifically described to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the invention. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A message processing method, characterized in that, Server-side components used in instant messaging systems include: Receive pending messages sent by the initiator; The system calls a predefined interface of an external task system to execute task processing rules on the message to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content. The format conversion unit is used to convert heterogeneous messages into a standard format. The path optimization unit is used to select a transmission path based on the network location of the receiver. Based on the receiver configuration information of at least one receiver, the processed message to be processed is sent to the at least one receiver.
2. The method according to claim 1, characterized in that, The invocation of the predefined interface of the external task system includes: Establish two-way communication with external mission systems through standard communication protocols; Upon receiving a policy update instruction, verify the integrity and version identifier of the policy update instruction; The interface call parameters are dynamically adjusted based on the execution results returned by the external task system.
3. The method according to claim 1, characterized in that, Before sending the processed message to the recipient, the method further includes: Based on the receiver configuration information, the processed message to be processed is stored in a hierarchical storage system, wherein the hierarchical storage system includes a first storage layer for storing real-time message identifiers and setting time-sensitive thresholds, a second storage layer for establishing a joint index based on receiver attributes and message characteristics, and a third storage layer for performing compression and block processing on the message content. Every first preset time period, the resource usage of the first storage layer is scanned, and if the resource usage exceeds a preset threshold, the real-time identifier of the message is cleared according to message priority. An incremental update operation is performed on the composite index in the second storage layer every second preset time period; Every third preset time period, a cross-regional data backup operation is performed on the message content in the third storage layer.
4. The method according to claim 1, characterized in that, Sending the processed message to at least one recipient includes: Detect the network connection status of at least one receiver; If at least one receiver is online, the priority identifier of the processed message to be processed is parsed. The processed message and verification code are pushed to the corresponding real-time transmission protocol according to the priority identifier. The verification code is generated based on the message content and is used to verify the confirmation response of the at least one recipient.
5. The method according to claim 4, characterized in that, After selecting the corresponding real-time transmission protocol based on the priority identifier and pushing the processed message and checksum, the method further includes: In the event of a real-time push failure, the complete message content is extracted from the second storage layer, which is used to establish a joint index based on receiver attributes and message characteristics. The message relay service is invoked to reassemble the processed message into a predefined format. The system retryes the push at preset intervals and checks the network connection status of at least one receiver before each retry.
6. The method according to claim 4, characterized in that, After selecting the corresponding real-time transmission protocol based on the priority identifier and pushing the processed message and checksum, the method further includes: When the receiver is offline, the complete message content is obtained from the third storage layer, wherein the third storage layer is used to perform compression and block processing on the message content; Call a third-party service to generate offline notification content based on the complete message content and push it offline. If the offline notification content is successfully pushed offline, the complete message content is cleared in the third storage layer.
7. The method according to claim 1, characterized in that, Sending the processed message to the at least one recipient includes: When at least one recipient is online through multiple terminals, the processed message to be processed is sent in parallel to all online terminal devices; When the target terminal performs a state change operation on the processed message to be processed, the state value corresponding to the state change operation is broadcast to other online terminals, wherein the target terminal is any one of the plurality of terminals.
8. An instant messaging system, characterized in that, It includes a server and at least two clients, wherein the at least two clients include an initiator and at least one receiver; The initiator is used to respond to the message sending operation, generate a message to be processed, and send the message to be processed to the server. The receiver is configured to generate receiver configuration information in response to the configuration operation, and send the receiver configuration information to the server. The server is used to receive the pending message sent by the initiator; The system calls a predefined interface of an external task system to execute task processing rules on the message to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content. The format conversion unit is used to convert heterogeneous messages into a standard format. The path optimization unit is used to select a transmission path based on the network location of the receiver. Based on the receiver configuration information of the at least one receiver, the processed message to be processed is sent to the at least one receiver.
9. A message processing device, characterized in that, include: The receiving module is configured to receive pending messages sent by the initiator; The processing module is configured to call a predefined interface of an external task system to execute task processing rules on the message to be processed. The task processing rules are strategies for controlling messages predefined by the external task system. The task processing rules include a processing pipeline composed of a semantic analysis unit, a format conversion unit, and a path optimization unit. The semantic analysis unit is used to detect the risk level of the message content, the format conversion unit is used to convert heterogeneous messages into a standard format, and the path optimization unit is used to select a transmission path based on the receiver's network location. The sending module is configured to send the processed message to the at least one recipient based on the recipient configuration information of the at least one recipient.
10. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the message processing method according to any one of claims 1-7.
Citation Information
Cited By
IM message priority dynamic scheduling system based on real-time behavior perception
CN122204812A