Message transmission method and device for instant messaging, storage medium, message sending end, message receiving end and computer program product
By adding a unique transmission identifier to each message and implementing a duplicate check and retransmission mechanism between the sender and receiver, combined with public and private message channel strategies, the reliability and real-time performance issues of message transmission in weak network environments for Socket and RPC communication are resolved, thereby improving the reliability of instant messaging and user experience.
Patent Information
- Application Number
- CN202411199076.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-01-10
AI Technical Summary
Existing Socket and RPC communication solutions cannot guarantee the reliability and real-time performance of message transmission in unstable network environments, especially in weak network environments where message loss or delay is likely to occur.
By employing a unique transmission identifier for each message and a mechanism for repeated checks and confirmations between the message sender and receiver, combined with a strategy of using both public and private message channels, reliable message transmission can be guaranteed.
It improves the reliability of message transmission in instant messaging scenarios, especially in online conversations, online transactions, and logistics tracking, ensuring timely message delivery and reducing transmission failures, thereby enhancing the user experience.
Smart Images

Figure CN119299410A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of message transmission, and in particular to a message transmission method and device for instant messaging, a storage medium, a message sending end, a message receiving end, and a computer program product. Background Art
[0002] With the rapid popularization and development of mobile Internet, people's demand for real-time message notifications and push notifications is increasing. Whether it is social media, instant messaging applications, or various mobile applications, users hope to receive important information and notifications in a timely manner, which puts higher requirements on the real-time and reliability of message notifications; and many application scenarios, such as online payment, transaction reminders, logistics tracking, etc., have strict requirements on the real-time and reliability of messages, and need to ensure that messages can be reliably delivered to target users; in addition, in a weak network environment, there will be problems such as network instability, severe packet loss, and large delays, which will greatly affect the real-time and reliability of message notifications.
[0003] In the prior art, message transmission mainly adopts a socket communication scheme and a remote procedure call (RPC) communication scheme.
[0004] (1) Socket communication uses the Web Socket communication protocol or the traditional TCP Socket or UDP Socket protocol to achieve two-way communication between two nodes. However, in this communication scheme, Socket creates a persistent connection, which means that during the communication process, the connection needs to be always open regardless of whether there is a message to be notified, which consumes a lot of resources. At the same time, it has high requirements for network quality. When network delays and interruptions occur, the reliability and timeliness of message notifications will be greatly affected, resulting in message loss or delayed arrival.
[0005] (2)RPC communication allows programs to call subroutines on remote computers just like calling local subroutines. The sender of the message sends the message to the receiver through an RPC request to implement message notification. Because the network link between the sender and receiver of RPC may not be stable, RPC services usually use a combination of "Long Connection" and "KeepAlive" to reuse connections. However, due to network fluctuations, if the connection is disconnected between two heartbeat detections, that is, a false connection occurs, the request will inevitably time out, which will result in the loss of the message. Summary of the invention
[0006] The technical problem solved by the embodiments of the present invention is how to improve the reliability of message transmission in an instant messaging scenario.
[0007] To solve the above technical problems, an embodiment of the present invention provides an instant messaging message transmission method, comprising the following steps: obtaining and publishing messages to be transmitted, each message to be transmitted containing a unique transmission identifier; after each publication of a message to be transmitted, repeatedly checking whether the received transmission identifier contains the transmission identifier of the message to be transmitted, wherein if a repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, then confirming that the transmission of the message to be transmitted has failed; republishing the message to be transmitted of which the transmission failure has been confirmed; wherein the received transmission identifier is extracted and sent by the message receiving end of each published message to be transmitted from the received message to be transmitted after successfully receiving the message to be transmitted.
[0008] Optionally, the message to be transmitted also includes a message sender identifier and a message receiver identifier, which are respectively used to indicate the message sender and message receiver of the message to be transmitted; obtaining the message to be transmitted and publishing it include: obtaining the message to be transmitted; determining the first message channel to which the message sender and message receiver of the message to be transmitted have subscribed, and publishing the message to be transmitted to the first message channel, wherein each combination of the message sender and the message receiver has a unique subscribed first message channel; wherein the message receiver of the message to be transmitted receives the message to be transmitted from the subscribed first message channel.
[0009] Optionally, before determining the first message channel to which the message sender and the message receiver of the message to be transmitted have subscribed, the method further includes: when receiving a message transmission request for the message to be transmitted, determining whether the message sender and the message receiver of the message to be transmitted have subscribed to the first message channel; if the judgment result is no, determining the second message channel to which the message receiver has subscribed; publishing a connection establishment request to the second message channel and subscribing to the first message channel, the connection establishment request being used to request the message receiver to subscribe to the first message channel; wherein the message receiver has a unique subscribed second message channel, which is used for publishing a connection establishment request to each message sender that needs to transmit a message to the message receiver.
[0010] Optionally, after each release of the message to be transmitted, the process repeatedly checks whether the received transmission identifiers contain the transmission identifier of the message to be transmitted. If the transmission identifier of the message to be transmitted is detected in the received transmission identifiers, it is confirmed that the transmission of the message to be transmitted is successful.
[0011] Optionally, the method also includes: after the message transmission program is restarted or abnormally interrupted, reading and publishing the messages to be transmitted from the first cache space, and each message to be transmitted in the first cache space is not lost after the message transmission program is restarted or abnormally interrupted; wherein all messages to be transmitted will be written to the first cache space; and whenever it is confirmed that the transmission of a message to be transmitted is successful, the message to be transmitted that has been confirmed to be successfully transmitted will be deleted from the first cache space.
[0012] An embodiment of the present invention also provides an instant messaging message transmission method, which is applied to a message receiving end, comprising: confirming successful receipt of a message to be transmitted from a message sending end, each message to be transmitted containing a unique transmission identifier; extracting the transmission identifier from the message to be transmitted, and sending the extracted transmission identifier to the message sending end.
[0013] Optionally, after extracting the transmission identifier from the message to be transmitted, the method further includes: checking whether a second cache space contains the transmission identifier extracted from the message to be transmitted, the second cache space being used to store the transmission identifiers of all successfully received messages to be transmitted; if the check result is that the second cache space already contains the transmission identifier, deleting the successfully received message to be transmitted.
[0014] Optionally, each transmission identifier in the second cache space is written into the second cache space in the order of reception of the to-be-transmitted messages to which they belong; the method also includes: when the storage space occupied by the transmission identifier in the second cache space is greater than or equal to a preset threshold, deleting multiple transmission identifiers with an earlier writing order, so that the storage space occupied by the transmission identifier in the second cache space is less than the preset threshold.
[0015] An embodiment of the present invention also provides an instant messaging message transmission device, comprising: a message publishing module, used to obtain and publish messages to be transmitted, each message to be transmitted containing a unique transmission identifier; a transmission confirmation module, used to repeatedly check whether the received transmission identifier contains the transmission identifier of the message to be transmitted after each release of the message to be transmitted, until the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, confirming that the transmission of the message to be transmitted has failed; a message republishing module, used to republish the message to be transmitted of which the transmission failure has been confirmed; wherein the received transmission identifier is extracted and sent from the received message to be transmitted by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
[0016] An embodiment of the present invention also provides an instant messaging message transmission device, including: a message reception confirmation module, used to confirm the successful receipt of a message to be transmitted from a message sending end, each message to be transmitted containing a unique transmission identifier; a transmission identifier sending module, used to extract a transmission identifier from the message to be transmitted, and send the extracted transmission identifier to the message sending end.
[0017] An embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the instant messaging message transmission method are executed.
[0018] An embodiment of the present invention further provides a message sending end, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the instant messaging message transmission method when running the computer program.
[0019] An embodiment of the present invention further provides a message receiving terminal, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the instant messaging message transmission method when running the computer program.
[0020] An embodiment of the present invention further provides a computer program product, including a computer program, which executes the steps of the instant messaging message transmission method when executed by a processor.
[0021] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects:
[0022] In an embodiment of the present invention, after each release of a message to be transmitted, a repeated check is performed to determine whether the received transmission identifier contains the transmission identifier of the message to be transmitted, wherein if a repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not detected in the received transmission identifier, then the transmission failure of the message to be transmitted is confirmed; and the message to be transmitted of which the transmission failure has been confirmed is republished; wherein the received transmission identifier is extracted and sent from the received message to be transmitted by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
[0023] As mentioned above, by using a unique transmission identifier for each message to be transmitted, confirming the successful reception of the message between the message sender and the message receiver, and the retransmission mechanism after the message transmission fails, the reliability of message transmission can be effectively guaranteed. Especially for instant messaging scenarios with high requirements for message transmission reliability (such as online conversations or meetings, online transactions, logistics tracking, etc.), it can ensure the smooth progress of instant messaging and improve user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of a message transmission method for instant messaging in an embodiment of the present invention;
[0025] Figure 2 yes Figure 1 A flowchart of a specific implementation of step S11;
[0026] Figure 3 is a flow chart of another instant messaging message transmission method according to an embodiment of the present invention;
[0027] Figure 4 It is a structural schematic diagram of a message transmission device for instant messaging in an embodiment of the present invention;
[0028] Figure 5 It is a structural schematic diagram of another instant messaging message transmission device in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the above-mentioned objects, features and beneficial effects of the present invention more obvious and understandable, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0030] Reference Figure 1 , Figure 1 This is a flowchart of a message transmission method for instant messaging in an embodiment of the present invention. The method can be applied to a message sending end, especially a message sending end (or message notification end) in an instant messaging application scenario, such as a terminal device used in online communication or conversation, online payment, transaction reminder, logistics tracking, autonomous driving, etc. The terminal device can be selected from but not limited to a mobile terminal (e.g., a smart phone, a smart watch, a tablet computer), a computer, a vehicle-mounted terminal, various sensors on an autonomous driving vehicle, as well as a server, a cloud platform, etc.
[0031] The method may include steps S11 to S13:
[0032] Step S11: Obtain and publish the message to be transmitted, each message to be transmitted contains a unique transmission identifier;
[0033] Step S12: after each release of the message to be transmitted, repeatedly check whether the received transmission identifiers contain the transmission identifier of the message to be transmitted, wherein if the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifiers, it is confirmed that the transmission of the message to be transmitted has failed;
[0034] Step S13: republishing the message to be transmitted for which transmission failure has been confirmed.
[0035] The received transmission identifier is extracted and sent by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
[0036] In the specific implementation of step S11, the message to be transmitted may come from one or more applications (APPs), functional modules or algorithm nodes of the message sending end. For example, whenever an application of the message sending end has a new message to be transmitted (or to be published), the application may issue a message transmission request; in response to receiving the message transmission request, the message sending end obtains the message to be transmitted requested from the application and then publishes it. Among them, the operation of publishing the message to be transmitted may be performed by an instant messaging APP, component or client configured at the message sending end.
[0037] Furthermore, after obtaining the message to be transmitted and before publishing the message to be transmitted, the message sender may first write the message to be transmitted into the first queue; wherein the message to be transmitted is read and published from the first queue. Furthermore, before writing into the first queue, the message to be transmitted may be serialized. Serialization helps to reduce network transmission volume and improve message transmission efficiency and timeliness.
[0038] In the specific implementation of step S12, after each release of the message to be transmitted, it is repeatedly checked whether the received transmission identifier contains the transmission identifier of the message to be transmitted. If the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, it is confirmed that the transmission of the message to be transmitted has failed.
[0039] Wherein, each time the message sending end receives a transmission identifier from the message receiving end, the received transmission identifier may be written into the second queue.
[0040] In the specific implementation of step S13, when it is confirmed that the message to be transmitted fails to be transmitted, the message to be transmitted can be republished. Specifically, before republishing the message to be transmitted, the message to be transmitted that has been confirmed to have failed to be transmitted can also be written into the first queue.
[0041] Furthermore, after each release of the message to be transmitted, the received transmission identifier is repeatedly checked to see whether it contains the transmission identifier of the message to be transmitted. If the transmission identifier of the message to be transmitted is detected in the received transmission identifier, it is confirmed that the message to be transmitted is transmitted successfully.
[0042] Specifically, each message to be transmitted published by the message sending end contains a unique transmission identifier, and the function of the transmission identifier is to uniquely identify a message transmission; after successfully receiving the message to be transmitted published by the message sending end, the message receiving end extracts the transmission identifier from the message to be transmitted, encapsulates it, and sends it to the message sending end in the form of a reply packet, so that the message sending end can confirm the successful transmission of the message. That is, if the message sending end receives the transmission identifier contained in the message to be transmitted, it can confirm that the message to be transmitted has been successfully transmitted (that is, it has been successfully received by the message receiving end).
[0043] In a specific implementation, since the transmission identifier sent by the message receiving end needs to take a certain period of time to be transmitted to the message sending end, an appropriate duplicate check termination condition can be set. For example, the duplicate check termination condition can be selected from: a preset duplicate check duration, a preset number of duplicate checks, etc.
[0044] In the embodiment of the present invention, by using a unique transmission identifier for each message to be transmitted, confirming the successful reception of the message between the message sending end and the message receiving end, and a retransmission mechanism after the message transmission fails, the reliability of message transmission can be effectively guaranteed. In particular, for instant messaging application scenarios, such as online conversations or meetings, instant messaging can be smoothly carried out, improving user experience.
[0045] Furthermore, each message to be transmitted may also include other information required in the actual application scenario, for example, the specific content of the message, the message sender identifier (used to indicate the sender of the message to be transmitted), and the message receiver identifier (used to indicate the receiver of the message to be transmitted); for example, it may include an identity verification identifier (token_id), which is used by the message receiver to verify the identity validity of the message sender; for example, it may include a message type identifier (msg_id), which is used to identify the type of message to be transmitted (image or video, etc.).
[0046] Reference Figure 2 , Figure 2 yes Figure 1 Flow chart of a specific implementation of step S11 in the embodiment. In this implementation, each message to be transmitted also includes a message sender identifier (sender_id) and a message receiver identifier (receiver_id), which are respectively used to indicate the message sender and the message receiver of the message to be transmitted; the step S11 may specifically include the following steps S111 to S112.
[0047] In step S111, the message to be transmitted is obtained.
[0048] In step S112, the first message channel to which the message sender and the message receiver of the message to be transmitted have subscribed is determined, and the message to be transmitted is published to the first message channel, wherein each combination of the message sender and the message receiver has a unique subscribed first message channel.
[0049] The message receiving end of the message to be transmitted receives the message to be transmitted from the subscribed first message channel.
[0050] The existing conventional message transmission scheme adopts end-to-end transmission. Specifically, the message receiving end opens a port for receiving messages, and different message sending ends directly send messages to the port. Since one port is used to receive messages from different message sending ends, the probability of message transmission errors will increase. In comparison, in an embodiment of the present invention, by setting a combination of a message sending end and a message receiving end, a one-to-one correspondence between the combination and the first message channel is established, that is, each combination of a message sending end and a message receiving end has a unique subscribed first message channel (also referred to as a "unique message channel"). The message sending end publishes messages to the unique message channel, and the message receiving end receives messages from the unique channel. Therefore, the probability of message transmission errors can be effectively reduced and the reliability of message transmission can be improved.
[0051] Furthermore, before determining the first message channel to which the message sender and the message receiver of the message to be transmitted have subscribed, the method also includes: when receiving a message transmission request for the message to be transmitted, determining whether the message sender and the message receiver of the message to be transmitted have subscribed to the first message channel; if the judgment result is no, determining the second message channel to which the message receiver has subscribed; publishing a connection establishment request to the second message channel and subscribing to the first message channel, the connection establishment request being used to request the message receiver to subscribe to the first message channel; wherein the message receiver has a unique subscribed second message channel, which is used for publishing a connection establishment request to each message sender that needs to transmit a message to the message receiver.
[0052] It is understandable that in some application scenarios, the message sender usually knows which message receiving end or ends need to send messages to, but the message receiving end often does not know which message senders will send messages to it initially. Therefore, the second message channel subscribed by the message receiving end can be regarded as a public message channel (public channel). Any message sender that needs to issue a connection establishment request to the message receiving end can issue a connection establishment request to the public message channel, so that the message receiving end can know which message senders need to send messages to it, and the message receiving end and each message sender that has issued a connection establishment request subscribe to a unique first message channel (that is, a unique message channel specifically used for message transmission between the message sender and the message receiving end).
[0053] Furthermore, compared to the existing Socket communication and RPC communication schemes, both of which establish a connection when the sending and receiving ends are started (i.e., a persistent connection mechanism), in an embodiment of the present invention, the above-mentioned "combination of a public message channel (i.e., the second message channel) with a unique message channel (i.e., the first message channel)" strategy is adopted. When a message transmission request for a message to be transmitted is received (i.e., when a message notification needs to be sent), a communication connection is established between the message sending end and the message receiving end by subscribing to the unique message channel. Thus, on the one hand, resource consumption can be effectively reduced; on the other hand, the probability of connection interruption or transmission delay can be reduced to a certain extent, especially in weak network environments such as unstable network, severe packet loss, and large delay. The above-mentioned scheme can effectively improve the reliability and real-time performance of message transmission.
[0054] Furthermore, the method also includes: after the message transmission program (i.e., the program used to execute the instant messaging message transmission method described in the present application) is restarted or abnormally interrupted, reading and publishing the messages to be transmitted from the first cache space, and each message to be transmitted in the first cache space is not lost after the message transmission program is restarted or abnormally interrupted; wherein all messages to be transmitted will be written to the first cache space; and whenever it is confirmed that the transmission of a message to be transmitted is successful, the message to be transmitted that has been confirmed to be successfully transmitted will be deleted from the first cache space.
[0055] Specifically, the first cache space may be a storage space divided from a disk, or a database of a remote dictionary server (Redis) may be used as the first cache space. Accordingly, the first queue for caching each message to be transmitted to be published as described above may be a storage space divided from a memory, and the data in the memory will be lost after the message transmission program is restarted or abnormally interrupted.
[0056] In the embodiment of the present invention, by using the first cache space to store all the pending messages whose transmission has not been confirmed to be successful, the persistence of the messages can be achieved, ensuring that all messages can reliably reach the receiving end, and further improving the reliability of message transmission.
[0057] Reference Figure 3 , Figure 3 This is a flowchart of another instant messaging message transmission method in an embodiment of the present invention. The method can be applied to a message receiving end, especially a message receiving end in an instant messaging application scenario, such as a terminal device used in online communication or conversation, online payment, transaction reminder, logistics tracking, autonomous driving, etc. The terminal device can be selected from but not limited to a mobile terminal (e.g., a smart phone, a smart watch, a tablet computer), a computer, a vehicle-mounted terminal, various sensors on an autonomous driving vehicle, as well as a server, a cloud platform, etc. The message receiving end in this embodiment can be connected to the above Figure 1 The message sending end of the embodiment shown in the figure communicates with each other, and the message sending end executes the above Figure 1 The method described in the illustrated embodiment sends a message, and correspondingly, the message receiving end executes the method described in this embodiment to receive the message.
[0058] The method may specifically include the following steps S31 to S32.
[0059] In step S31, it is confirmed that the message to be transmitted from the message sending end is successfully received, and each message to be transmitted includes a unique transmission identifier.
[0060] In step S32, a transmission identifier is extracted from the message to be transmitted, and the extracted transmission identifier is sent to the message sending end.
[0061] Furthermore, after extracting the transmission identifier from the message to be transmitted, the method also includes: checking whether the second cache space contains the transmission identifier extracted from the message to be transmitted, the second cache space being used to store the transmission identifiers of all successfully received messages to be transmitted; if the check result is that the second cache space already contains the transmission identifier, deleting the successfully received message to be transmitted.
[0062] In a specific implementation, the second cache space may also be a storage space divided from a disk, and the data therein will not be lost after the message transmission program is restarted or abnormally interrupted.
[0063] It is understandable that if the message receiving end successfully receives the message, but the reply packet (including the transmission identifier of the successfully received message) sent to the message sending end is lost, the message sending end will republish the message because it fails to receive the transmission identifier of the message, which will cause the message receiving end to receive duplicate messages. Therefore, by adopting the above-mentioned second cache space, retransmission check, and deduplication mechanism, the problem of receiving duplicate messages can be effectively avoided.
[0064] Furthermore, each transmission identifier in the second cache space is written into the second cache space in the order of reception of the messages to be transmitted to which they belong; the method also includes: when the storage space occupied by the transmission identifier in the second cache space is greater than or equal to a preset threshold, deleting multiple transmission identifiers with an earlier writing order, so that the storage space occupied by the transmission identifier in the second cache space is less than the preset threshold.
[0065] It can be understood that the earlier the reception order of the message to be transmitted is, the earlier the order in which the transmission identifier of the message is written into the second cache space is, and for the transmission identifier with an earlier writing order, if it is lost in the process of being transmitted back to the message sending end, the message sending end will retransmit the message in a shorter time, and correspondingly, the message receiving end will complete the retransmission detection in a shorter time. Therefore, when the storage space occupied by the transmission identifier in the second cache space is greater than or equal to the preset threshold, the multiple transmission identifiers with an earlier writing order (i.e., the transmission identifiers for which retransmission detection has been completed) can be preferentially deleted from the second cache space. In this way, the impact on retransmission detection and message deduplication can be minimized.
[0066] about Figure 3 For more details of steps S31 to S32 in the illustrated embodiment, see the previous text and Figure 1 , Figure 2 The relevant description of the illustrated embodiment will not be repeated here.
[0067] Reference Figure 4 , Figure 4 This is a schematic diagram of the structure of an instant messaging message transmission device in an embodiment of the present invention. The device may include:
[0068] The message publishing module 41 is used to obtain and publish messages to be transmitted, each message to be transmitted contains a unique transmission identifier;
[0069] The transmission confirmation module 42 is used to repeatedly check whether the transmission identifier of the message to be transmitted is included in the received transmission identifier after each release of the message to be transmitted, until the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, and confirm that the transmission of the message to be transmitted has failed;
[0070] A message republishing module 43, configured to republish the message to be transmitted that has been confirmed to have failed in transmission;
[0071] The received transmission identifier is extracted and sent by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
[0072] For the principle, specific implementation and beneficial effects of the message transmission device, please refer to the previous article and Figure 1 to Figure 2 The relevant description of the message transmission method for instant messaging shown in any embodiment will not be repeated here.
[0073] Reference Figure 5 , Figure 5 This is a schematic diagram of the structure of another instant messaging message transmission device in an embodiment of the present invention. The device may include:
[0074] A message receiving confirmation module 51 is used to confirm that a message to be transmitted from a message sending end is successfully received, and each message to be transmitted includes a unique transmission identifier;
[0075] The transmission identifier sending module 52 is used to extract the transmission identifier from the message to be transmitted, and send the extracted transmission identifier to the message sending end.
[0076] For the principle, specific implementation and beneficial effects of the message transmission device, please refer to the previous article and Figure 3 The description of the instant messaging message transmission method shown above will not be repeated here.
[0077] The embodiment of the present invention further provides a storage medium, such as a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor. Figure 1 to Figure 2 The steps of the instant messaging message transmission method shown, or executing the above Figure 3 The steps of the instant messaging message transmission method are shown. The computer-readable storage medium may include a non-volatile memory or a non-transitory memory, and may also include an optical disk, a mechanical hard disk, a solid-state hard disk, etc.
[0078] Specifically, in the embodiment of the present invention, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0079] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct rambus RAM (DR RAM).
[0080] The embodiment of the present invention further provides a message sending end, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 1 to Figure 2Any one of the embodiments shows the steps of the instant messaging message transmission method.
[0081] The embodiment of the present invention further provides a message receiving terminal, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 3 The steps of the instant messaging message transmission method are shown.
[0082] The embodiment of the present invention also provides a computer program product, including a computer program, wherein the computer program is executed when the processor is running. Figures 1 to 3 Any one of the embodiments shows the steps of the instant messaging message transmission method.
[0083] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship.
[0084] The "plurality" appearing in the embodiments of the present application refers to two or more.
[0085] The first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects. There is no order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.
[0086] It should be pointed out that the serial numbers of the steps in this embodiment do not limit the execution order of the steps.
[0087] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A message transmission method for instant messaging, applied to a message sending end, characterized in that: include: Get the message to be transmitted and publish it. Each message to be transmitted contains a unique transmission identifier. After each release of a message to be transmitted, repeatedly check whether the received transmission identifier contains the transmission identifier of the message to be transmitted, wherein if the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, it is confirmed that the transmission of the message to be transmitted has failed; Republishing the message to be transmitted for which transmission failure has been confirmed; The received transmission identifier is extracted and sent by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
2. The method according to claim 1, characterized in that The message to be transmitted also includes a message sending end identifier and a message receiving end identifier, which are used to indicate the message sending end and the message receiving end of the message to be transmitted respectively; The obtaining and publishing of the message to be transmitted includes: Obtaining the message to be transmitted; Determine a first message channel to which a message sender and a message receiver of the message to be transmitted have subscribed, and publish the message to be transmitted to the first message channel, wherein each combination of a message sender and a message receiver has a unique subscribed first message channel; The message receiving end of the message to be transmitted receives the message to be transmitted from the subscribed first message channel.
3. The method according to claim 2, characterized in that Before determining the first message channel to which the message sending end and the message receiving end of the message to be transmitted have subscribed, the method further includes: Upon receiving a message transmission request for the message to be transmitted, determining whether a message sending end and a message receiving end of the message to be transmitted have a subscribed first message channel; If the judgment result is no, determining the second message channel to which the message receiving end has subscribed; Publishing a connection establishment request to the second message channel and subscribing to the first message channel, wherein the connection establishment request is used to request the message receiving end to subscribe to the first message channel; The message receiving end has a unique subscribed second message channel, which is used for each message sending end that needs to transmit a message to the message receiving end to issue a connection establishment request.
4. The method according to claim 1, characterized in that After each release of a message to be transmitted, the received transmission identifier is repeatedly checked to see whether it contains the transmission identifier of the message to be transmitted. If the transmission identifier of the message to be transmitted is detected in the received transmission identifier, it is confirmed that the message to be transmitted is transmitted successfully.
5. The method according to claim 4, characterized in that The method further comprises: After the message transmission program is restarted or abnormally interrupted, the messages to be transmitted are read from the first cache space and published, and each message to be transmitted in the first cache space is not lost after the message transmission program is restarted or abnormally interrupted; Among them, all the messages to be transmitted will be written into the first cache space; whenever it is confirmed that the message to be transmitted is successfully transmitted, the message to be transmitted that has been confirmed to be successfully transmitted will be deleted from the first cache space.
6. A message transmission method for instant messaging, applied to a message receiving end, characterized in that: include: Confirm that the message to be transmitted from the message sender is successfully received, and each message to be transmitted contains a unique transmission identifier; A transmission identifier is extracted from the message to be transmitted, and the extracted transmission identifier is sent to the message sending end.
7. The method according to claim 6, characterized in that After extracting the transmission identifier from the message to be transmitted, the method further includes: Checking whether the second cache space contains the transmission identifier extracted from the message to be transmitted, the second cache space being used to store the transmission identifiers of all successfully received messages to be transmitted; If the checking result is that the second cache space already contains the transmission identifier, the successfully received message to be transmitted is deleted.
8. The method according to claim 7, characterized in that Each transmission identifier in the second cache space is written into the second cache space in the order in which the to-be-transmitted messages to which they belong are received; The method further comprises: When the storage space occupied by the transmission identifier in the second cache space is greater than or equal to a preset threshold, multiple transmission identifiers written earlier are deleted so that the storage space occupied by the transmission identifier in the second cache space is less than the preset threshold.
9. An instant messaging message transmission device, characterized in that: include: The message publishing module is used to obtain and publish messages to be transmitted. Each message to be transmitted contains a unique transmission identifier. A transmission confirmation module is used to repeatedly check whether the transmission identifier of the message to be transmitted is included in the received transmission identifier after each release of the message to be transmitted, until the repeated check termination condition is met and the transmission identifier of the message to be transmitted is still not checked in the received transmission identifier, and confirm that the transmission of the message to be transmitted has failed; A message republishing module, used for republishing the message to be transmitted that has been confirmed to have failed to transmit; The received transmission identifier is extracted and sent by the message receiving end of each published message to be transmitted after successfully receiving the message to be transmitted.
10. An instant messaging message transmission device, characterized in that: include: A message receiving confirmation module is used to confirm the successful receipt of the message to be transmitted from the message sending end, each message to be transmitted contains a unique transmission identifier; The transmission identifier sending module is used to extract the transmission identifier from the message to be transmitted and send the extracted transmission identifier to the message sending end.
11. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the instant messaging message transmission method according to any one of claims 1 to 5 are executed, or the steps of the instant messaging message transmission method according to any one of claims 6 to 8 are executed.
12. A message sending end, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the instant messaging message transmission method according to any one of claims 1 to 5 are performed.
13. A message receiving terminal, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the instant messaging message transmission method according to any one of claims 6 to 8 are performed.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the instant messaging message transmission method according to any one of claims 1 to 5 are executed, or the steps of the instant messaging message transmission method according to any one of claims 6 to 8 are executed.