Message transmission method and device, electronic equipment and storage medium

By using the MQTT protocol to transmit message sub-messages without file entities and the HTTP protocol to transmit message sub-messages with file entities in message transmission, the problem of weakening of message transmission reliability in traditional technology is solved, and efficient and reliable message transmission is achieved. Improved service quality.

CN119172342APending Publication Date: 2024-12-20CHINA TOWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411303159.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In the massive user scenario, the traditional socket protocol based on TCP/IP protocol has weakened the reliability of message transmission, which cannot guarantee the service quality of message transmission, especially the establishment and maintenance of channels between a large number of clients and servers, and information In scenarios such as notification, synchronization, read message feedback, and super-large group message communication.

Method used

The MQTT protocol is used to transmit message sub-messages without file entities, and the message sub-messages with file entities are transmitted through the HTTP protocol. Combined with the characteristics of MQTT and HTTP protocols, the reliability of message transmission and service quality assurance is achieved.

Benefits of technology

It enhances the reliability of message transmission, reduces data delay overhead, improves the timeliness of large concurrent user messages, reduces server pressure, and ensures high performance and reliability of message transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172342A_ABST
    Figure CN119172342A_ABST
Patent Text Reader

Abstract

The invention discloses a message transmission method and device, electronic equipment and a storage medium, belongs to the technical field of communication, and is used for improving the reliability of message transmission. The method comprises the following steps: acquiring a target message to be transmitted; under the condition that the target message comprises a first sub-message without a file entity, transmitting the first sub-message to a client through an MQTT protocol; and under the condition that the target message comprises a second sub-message of a file entity, transmitting the second sub-message to the client through an HTTP (Hyper Text Transport Protocol).
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and specifically relates to a message transmission method, device, electronic device and storage medium. Background Art

[0002] In traditional instant messaging, the socket protocol based on the TCP / IP protocol family is used to realize information transmission, and each message signaling, data body, and terminal status are transmitted based on it. In the scenario of massive users, due to the establishment and maintenance of channels between a large number of clients and servers, the business processing brought by scenarios such as offline / multi-terminal synchronization of receiving end information notification, synchronization, message reading feedback, and super-large group message communication, and the impact of data body information transmission such as files on real-time communication, the pressure on the server side is doubled, which will weaken the reliability of message transmission and make it impossible to guarantee the service quality of message transmission. Summary of the invention

[0003] The embodiments of the present application provide a message transmission method, device, electronic device and storage medium, which can solve the problem of weakening the reliability of message transmission and being unable to guarantee the service quality of message transmission.

[0004] In a first aspect, an embodiment of the present application provides a message transmission method, the method comprising: obtaining a target message to be transmitted; when the target message includes a first sub-message without a file entity, transmitting the first sub-message to a client via the MQTT protocol; when the target message includes a second sub-message with a file entity, transmitting the second sub-message to the client via the HTTP protocol.

[0005] In second aspect, an embodiment of the present application provides a message transmission device, which includes: an acquisition module, used to acquire a target message to be transmitted; a first transmission module, used to transmit the first sub-message to a client through the MQTT protocol when the target message includes a first sub-message without a file entity; and a second transmission module, used to transmit the second sub-message to the client through the HTTP protocol when the target message includes a second sub-message with a file entity.

[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0008] In an embodiment of the present application, the reliability of message transmission can be enhanced by acquiring a target message to be transmitted; when the target message includes a first sub-message without a file entity, transmitting the first sub-message to the client through the MQTT protocol; and when the target message includes a second sub-message with a file entity, transmitting the second sub-message to the client through the HTTP protocol. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 It is a flowchart of a message transmission method provided in an embodiment of the present application; Figure 2 This is a schematic diagram of a message transmission communication architecture provided by an embodiment of the present application; Figure 3 It is a schematic diagram of an MQTT protocol and an OSI reference model provided in an embodiment of the present application; Figure 4 This is a schematic diagram of a service quality assurance distribution provided by an embodiment of the present application; Figure 5 It is a structural diagram of a message transmission device provided in an embodiment of the present application; Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0010] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0011] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0012] The message transmission method, device, electronic device and storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0013] Figure 1 A message transmission method provided by an embodiment of the present application is shown, and the method can be performed by a server. In other words, the method can be performed by software or hardware installed on the server, and the method includes the following steps: Step 102: Obtain the target message to be transmitted.

[0014] In the embodiment of the present application, the transmission of instant messaging messages can be a client (sender)-server-client (receiver) transmission mode. That is, both the sender and the receiver's clients transmit messages through the server. It can also be a server-client (receiver) transmission mode, in which only the server and the receiver's client transmit messages. Therefore, in the embodiment of the present application, the target message sent by the sender's client can be obtained, such as a chat message, etc., or it can be a target message generated by the server, such as a system notification. The target message is not specifically limited here.

[0015] Step 104: When the target message includes a first sub-message without a file entity, the first sub-message is transmitted to the client via the MQTT protocol.

[0016] Specifically, when the target message includes a first sub-message without a file entity, the first sub-message can be transmitted to the client of the recipient through the MQTT protocol. Specifically, for example Figure 2 As shown in the communication architecture diagram, the first sub-message of the fileless entity transmitted through the MQTT protocol can be message signaling, text messages, system prompts, push messages, links (URLs), and other messages with high real-time and high concurrency. The MQTT protocol is a client-server based message publish / subscribe transmission protocol. Based on the publish / subscribe message model, a one-to-many message distribution mechanism can be provided, and the MQTT protocol is a low-overhead, low-bandwidth instant messaging protocol, and a real-time and reliable message service. The MQTT protocol is suitable for high-concurrency and high-real-time application scenarios, and has low transmission data and network bandwidth overhead. Figure 3 As shown in Figure 1, the MQTT protocol runs on top of the Transmission Control Protocol / Internet Protocol (TCP / IP) stack, and its position in the OSI reference model (7-layer model) is as follows: Figure 3 In addition, HTTP protocols such as Https or connection-oriented WebSocket can be used to replace HTTP protocols depending on different application environments.

[0017] Step 106: When the target message includes a second sub-message including a file entity, the second sub-message is transmitted to the client via the HTTP protocol.

[0018] Specifically, when the target message includes a second sub-message containing a file entity, the second sub-message can be transmitted to the receiving client through the HTTP protocol. The HTTP protocol has wide compatibility, is simple and fast to implement, has a connectionless feature that occupies little network resources, and supports the transmission of various types of messages. Figure 2 As shown in the figure, the second sub-message with the file entity can be a message with a large amount of data, such as pictures, audio, and video. The HTTP protocol can transmit data (HTML files, picture files, query results, etc.) based on the TCP / IP communication protocol. When the client requests a service from the server, it only needs to transmit the request method and path. The commonly used request methods are GET, HEAD, and POST. After the server processes the client's request and receives the client's response, it disconnects. HTTP allows the transmission of any type of data object. The HTTP protocol is suitable for the transmission of large amounts of information such as files, pictures, audio, and video in instant messaging scenarios, which do not require high real-time and reliability.

[0019] The message transmission method provided in the embodiment of the present application can enhance the reliability of message transmission by acquiring the target message to be transmitted; in the case where the target message includes a first sub-message without a file entity, transmitting the first sub-message to the client through the MQTT protocol; in the case where the target message includes a second sub-message with a file entity, transmitting the second sub-message to the client through the HTTP protocol. Combining the advantages of the characteristics of the two types of connection-oriented and connectionless communication protocols, the MQTT protocol and the HTTP protocol are applied to various business scenarios of instant messaging, and the decoupled transmission of the first sub-message and the second sub-message is realized, reducing the data delay overhead and ensuring the high performance of message transmission. The connection-oriented characteristics of the TCP / IP protocol family in the MQTT protocol are used to ensure the stability of the client-server message link, and the characteristics of the message publish / subscribe protocol in the MQTT protocol are used to ensure the reliability, lightness and speed of message signaling transmission. The HTTP protocol is used to ensure the safe delivery of message files by its wide compatibility characteristics for large message data transmission and its quick application landing. It can improve the timeliness of message communication delivery for large concurrent users, enhance the reliability of message transmission, reduce the pressure on the server for obtaining files, pictures, audio and video files, and provide timely feedback on client keep-alive, client status update and other links.

[0020] In an implementation, before obtaining the target message to be transmitted, the method further includes: monitoring the status of the client through the monitoring function of the MQTT protocol, where the status of the client includes: online, offline or suspended.

[0021] For example Figure 2As shown, in the embodiment of the present application, some enhanced functions are implemented based on the MQTT protocol and the HTTP protocol, and the client heartbeat detection and keep-alive mechanism are added to the MQTT protocol to implement the monitoring function, and then the client online, offline, suspended and other states can be obtained through the monitoring function of the MQTT protocol. In this way, extending the client heartbeat detection and keep-alive on the MQTT protocol can reduce the additional communication channel overhead.

[0022] In one implementation, after the target message to be transmitted is obtained, the method further includes: when there are multiple target messages, performing sequence control on the multiple target messages through the MQTT protocol.

[0023] Specific, for example Figure 2 As shown, the enhanced function can also include a message sequence function. When there are multiple target messages, the multiple target messages can be sequenced and controlled through the MQTT protocol. Through sequence control, the timing of message reading by each client is not affected by factors such as the device time, time zone, network delay, etc. of many clients and servers.

[0024] In one implementation, transmitting the first sub-message to the client via the MQTT protocol includes: The first sub-message is transmitted to the client according to the application scenario of the first sub-message and the service quality guarantee of the MQTT protocol.

[0025] In an embodiment of the present application, the first sub-message can be transmitted to the client according to the application scenario of the first sub-message and the service quality guarantee of the MQTT protocol, and the quality guarantee level of MQTT can be adapted to different message types. The service quality guarantee of the MQTT protocol generally includes: QoS0, QoS1 and QoS2. Among them, QoS0: at most once, when the message is sent to the recipient via the MQTT protocol, the MQTT protocol does not resend the message and confirm the message reception, and provides the same communication guarantee as the TCP / IP protocol. QoS1: at least once, when the message is sent to the recipient via the MQTT protocol, the MQTT protocol guarantees that the recipient receives the message, providing a higher communication guarantee than the TCP / IP protocol. QoS2: only once, when the message is sent to the recipient via the MQTT protocol, the MQTT protocol guarantees that the recipient receives the message and will not receive duplicate information, providing a higher communication guarantee than the TCP / IP protocol.

[0026] In one implementation, the transmitting the first sub-message to the client according to the service quality guarantee corresponding to the application scenario of the first sub-message includes: when the application scenario of the first sub-message is single chat or group chat and the first sub-message is a text message or a link, the first sub-message is transmitted to the client only once through the MQTT protocol; when the application scenario of the first sub-message is group chat and the first sub-message is a read mark message or a group management message, the first sub-message is transmitted to the client at least once through the MQTT protocol; when the application scenario of the first sub-message is an announcement or a system prompt, the first sub-message is transmitted to the client at least once through the MQTT protocol; when the application scenario of the first sub-message is a message notification, the first sub-message is transmitted to the client at most once through the MQTT protocol.

[0027] Specifically, as follows Figure 4 The service quality guarantee distribution shown, where, when the application scenario of the first sub-message is single chat or group chat and the first sub-message is a text message, the service quality guarantee of QoS2 is matched for the data transmission, that is, the first sub-message is transmitted to the client only once through the MQTT protocol. When the application scenario of the first sub-message is single chat or group chat and the first sub-message is a link message of a file, audio, video or picture, the service quality guarantee of QoS2 is matched for the data transmission, that is, the first sub-message is transmitted to the client only once through the MQTT protocol. When the application scenario of the second sub-message is single chat, the second sub-message is transmitted through the HTTP protocol.

[0028] like Figure 4 As shown, when the application scenario of the first sub-message is group chat and the first sub-message is a read mark message or a group management message, the service quality guarantee of QoS1 is matched for the data transmission, that is, the first sub-message is transmitted to the client through the MQTT protocol at least once.

[0029] like Figure 4 As shown, when the application scenario of the first sub-message is an announcement (group announcement, system announcement) or a system prompt, the service quality guarantee of QoS1 is matched for the data transmission, that is, the first sub-message is transmitted to the client through the MQTT protocol at least once.

[0030] like Figure 4 As shown, when the application scenario of the first sub-message is message notification, the service quality guarantee of QoS0 is matched for the data transmission, that is, the first sub-message is transmitted to the client at most once through the MQTT protocol.

[0031] QoS0, QoS1, and QoS2 data receiving / sending service quality assurance are provided for message transmission, and are graded and applied to scenarios such as announcements, reminders, single chat messages, group messages, and file messages. On the basis of ensuring the overall quality service level of instant messaging, the system pressure can be effectively reduced. In addition, the service quality assurance adaptation of each scenario can be flexibly adjusted according to the weight of the message scenario and the weight of system resource overhead.

[0032] In one implementation, before transmitting the second sub-message to the client via the HTTP protocol, it also includes: providing secure transmission guarantee service and integrity verification for the second sub-message via the HTTP protocol.

[0033] In the embodiments of the present application, Figure 2 As shown, the enhanced functions also include providing secure transmission guarantee (HTTPS) service and integrity verification for the second message through the HTTP protocol, thereby ensuring the secure transmission of the message, and ensuring the integrity of the message body through the Http protocol and integrity verification mechanism.

[0034] In one implementation, before transmitting the first sub-message to the client through the MQTT protocol, the method further includes: managing the client through a token.

[0035] In the embodiments of the present application, Figure 2 As shown, the enhanced functions also include ensuring the security of the client through token management, which improves the security of message transmission.

[0036] It should be noted that the execution subject of the message transmission method provided in the embodiment of the present application may be a message transmission device, or a control module in the message transmission device for executing the message transmission method. In the embodiment of the present application, the message transmission device provided in the embodiment of the present application is described by taking the execution of the message transmission method by the message transmission device as an example.

[0037] Figure 5 Schematic diagram of the structure of a message transmission device according to an embodiment of the present application. Figure 5 As shown, the message transmission device 500 includes: an acquisition module 510, a first transmission module 520 and a second transmission module 530. The acquisition module 510 is used to acquire a target message to be transmitted; the first transmission module 520 is used to transmit the first sub-message to the client through the MQTT protocol when the target message includes a first sub-message without a file entity; the second transmission module 530 is used to transmit the second sub-message to the client through the HTTP protocol when the target message includes a second sub-message with a file entity.

[0038] In one implementation, the acquisition module 510 is further configured to monitor the status of the client through the monitoring function of the MQTT protocol, where the status of the client includes: online, offline, or suspended.

[0039] In an implementation, the first transmission module 520 is further configured to, when there are multiple target messages, perform sequence control on the multiple target messages through the MQTT protocol.

[0040] In one implementation, the first transmission module 520 is used to transmit the first sub-message to the client according to the application scenario of the first sub-message and the quality of service of the MQTT protocol.

[0041] In one implementation, the first transmission module 520 is used to transmit the first sub-message to the client through the MQTT protocol only once when the application scenario of the first sub-message is a single chat or a group chat and the first sub-message is a text message or a link; when the application scenario of the first sub-message is a group chat and the first sub-message is a read mark message or a group management message, transmit the first sub-message to the client through the MQTT protocol at least once; when the application scenario of the first sub-message is an announcement or a system prompt, transmit the first sub-message to the client through the MQTT protocol at least once; when the application scenario of the first sub-message is a message notification, transmit the first sub-message to the client through the MQTT protocol at most once.

[0042] In one implementation, the second transmission module 530 is further used to provide secure transmission guarantee services and integrity verification for the second message through the HTTP protocol.

[0043] In one implementation, the acquisition module 510 is also used to manage the client through a token.

[0044] The message transmission device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0045] The message transmission device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0046] The message transmission device provided in the embodiment of the present application can achieve Figures 1 to 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0047] like Figure 6 As shown, an embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602, wherein the memory 602 stores a program or instruction that can be executed on the processor 601, and the program or instruction, when executed by the processor 601, implements: obtaining a target message to be transmitted; in a case where the target message includes a first sub-message without a file entity, transmitting the first sub-message to the client via the MQTT protocol; in a case where the target message includes a second sub-message with a file entity, transmitting the second sub-message to the client via the HTTP protocol.

[0048] In one implementation, before acquiring the target message to be transmitted, the status of the client is monitored through the monitoring function of the MQTT protocol, and the status of the client includes: online, offline or suspended.

[0049] In one implementation, after the target message to be transmitted is acquired, if there are multiple target messages, sequence control is performed on the multiple target messages through the MQTT protocol.

[0050] In one implementation, the first sub-message is transmitted to the client according to an application scenario of the first sub-message and quality of service of the MQTT protocol.

[0051] In one implementation, when the application scenario of the first sub-message is single chat or group chat and the first sub-message is a text message or a link, the first sub-message is transmitted to the client through the MQTT protocol only once; when the application scenario of the first sub-message is group chat and the first sub-message is a read mark message or a group management message, the first sub-message is transmitted to the client through the MQTT protocol at least once; when the application scenario of the first sub-message is an announcement or a system prompt, the first sub-message is transmitted to the client through the MQTT protocol at least once; when the application scenario of the first sub-message is a message notification, the first sub-message is transmitted to the client through the MQTT protocol at most once.

[0052] In one implementation, before transmitting the second sub-message to the client via the HTTP protocol, a secure transmission guarantee service and integrity verification are provided for the second sub-message via the HTTP protocol.

[0053] In one implementation, before transmitting the first sub-message to the client through the MQTT protocol, the client is managed through a token.

[0054] The specific execution steps can refer to the various steps of the above-mentioned message transmission method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.

[0055] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals, or other devices except terminals.

[0056] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0057] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory 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. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).

[0058] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.

[0059] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned message transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0060] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as ROM, RAM, magnetic disk or optical disk.

[0061] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0063] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A message transmission method, characterized in that: include: Get the target message to be transmitted; In a case where the target message includes a first sub-message without a file entity, transmitting the first sub-message to the client through the MQTT protocol; In the case that the target message includes a second sub-message including a file entity, the second sub-message is transmitted to the client via the HTTP protocol.

2. The method according to claim 1, characterized in that Before obtaining the target message to be transmitted, the method further includes: The status of the client is monitored through the monitoring function of the MQTT protocol, and the status of the client includes: online, offline or suspended.

3. The method according to claim 1, characterized in that After obtaining the target message to be transmitted, the method further includes: When there are multiple target messages, the multiple target messages are sequence-controlled through the MQTT protocol.

4. The method according to claim 1, characterized in that The transmitting the first sub-message to the client via the MQTT protocol includes: The first sub-message is transmitted to the client according to the application scenario of the first sub-message and the service quality guarantee of the MQTT protocol.

5. The method according to claim 4, characterized in that The transmitting the first sub-message to the client according to the quality of service guarantee corresponding to the application scenario of the first sub-message includes: When the application scenario of the first sub-message is a single chat or a group chat and the first sub-message is a text message or a link, transmitting the first sub-message to the client through the MQTT protocol only once; When the application scenario of the first sub-message is group chat and the first sub-message is a read mark message or a group management message, transmitting the first sub-message to the client through the MQTT protocol at least once; When the application scenario of the first sub-message is an announcement or a system prompt, transmitting the first sub-message to the client through the MQTT protocol at least once; When the application scenario of the first sub-message is message notification, the first sub-message is transmitted to the client via the MQTT protocol at most once.

6. The method according to claim 1, characterized in that Before transmitting the second sub-message to the client through the HTTP protocol, the method further includes: The HTTP protocol provides secure transmission guarantee services and integrity verification for the second message.

7. The method according to claim 1, characterized in that Before transmitting the first sub-message to the client through the MQTT protocol, the method further includes: Clients are managed through tokens.

8. A message transmission device, characterized in that: include: An acquisition module, used for acquiring a target message to be transmitted; A first transmission module, configured to transmit, when the target message includes a first sub-message without a file entity, the first sub-message to the client through the MQTT protocol; The second transmission module is used to transmit the second sub-message to the client through the HTTP protocol when the target message includes a second sub-message with a file entity.

9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the message transmission method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the message transmission method according to any one of claims 1 to 7 are implemented.