CN110875887A - MQTT protocol-based communication interaction method and communication interaction system - Google Patents

MQTT protocol-based communication interaction method and communication interaction system Download PDF

Info

Publication number
CN110875887A
CN110875887A CN201811009545.3A CN201811009545A CN110875887A CN 110875887 A CN110875887 A CN 110875887A CN 201811009545 A CN201811009545 A CN 201811009545A CN 110875887 A CN110875887 A CN 110875887A
Authority
CN
China
Prior art keywords
message
messages
priority
mqtt protocol
communication interaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811009545.3A
Other languages
Chinese (zh)
Inventor
易爱国
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NIO Holding Co Ltd
Original Assignee
NIO Nextev Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NIO Nextev Ltd filed Critical NIO Nextev Ltd
Priority to CN201811009545.3A priority Critical patent/CN110875887A/en
Publication of CN110875887A publication Critical patent/CN110875887A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6275Queue scheduling characterised by scheduling criteria for service slots or service orders based on priority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6215Individual queue per QOS, rate or priority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to a communication interaction device and a communication interaction method based on an MQTT protocol. The communication interaction device comprises a process module, wherein the process module comprises: the message production module is used for organizing and processing different message messages through a plurality of threads; and the MQTT protocol module is used for realizing MQTT communication and is set to have a plurality of priority queues. According to the invention, different priority queues can be established in the mosquitto, high-priority messages (urgent messages, such as protocol interaction packets PING, SUBSCRIBE, UNSUBSCRIBE messages, client state messages, reply messages of APP control commands and the like) are sent to the high-priority queues, and low-priority messages (non-urgent messages) are sent to the low-priority queues, so that the normal protocol communication is ensured.

Description

MQTT protocol-based communication interaction method and communication interaction system
Technical Field
The invention relates to a vehicle communication technology, in particular to a communication interaction method, a communication interaction device and a communication interaction system based on an MQTT protocol.
Background
MQTT (Message Queuing Telemetry Transport) is a "lightweight" communication protocol based on publish/subscribe (publish/subscribe) mode, which is built on TCP/IP protocol and published by IBM in 1999. The MQTT has the greatest advantage that a real-time reliable message service can be provided for connecting remote devices with few codes and limited bandwidth. The instant messaging protocol is low in cost and bandwidth occupation, and is widely applied to the aspects of Internet of things, small equipment, mobile application and the like.
When the MQTT protocol at the vehicle end is applied, an implementation library of the MQTT protocol is inevitably used, and the use of the mosquitto at the vehicle end is the best choice because the mosquitto completely implements the MQTT protocol, is open-source, is realized in a cross-platform manner, is easy to transplant, has a relatively clear structure and relatively perfect functions. However, the mosquitto has some problems in the mobile network environment at the vehicle end under the conditions of weak network environment conditions (low bandwidth, high delay, network handover, network congestion).
The method can cause that some messages which are not published successfully (the meaning of publishing can be referred to as the following description) can start to be sent again, and the later newly generated messages are added into a sending queue, at this time, a large number of messages to be sent again appear in the queue, if the messages are not very important messages, the sending queue is always occupied, at this time, some very important messages and urgent events occur, and the messages can be sent only after the sending of the previous messages is finished.
If the Qos of the low-priority message is =0, because it does not need to reply a publish ack, and such a message excessively occupies the transmission bandwidth of other messages, the mosquitto determines whether a connection exists and needs to depend on a PINGRSP packet, and a PING packet cannot be sent out due to blocking, thereby causing the mosquitto reconnect.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
In view of the above problems, the present invention provides a vehicle-end mosquitto communication method and a communication interaction system based on MQTT protocol in a weak network environment, which can distinguish different priority queues to realize communication.
The communication interaction device based on the MQTT protocol is characterized by comprising a process module,
wherein the process module comprises:
the message production module is used for organizing and processing different message messages through a plurality of threads;
optionally, the message production module marks a synchronization status message of the communication interaction device and a reply message of the control command as high priority.
An MQTT protocol module used for realizing MQTT communication,
the MQTT protocol module is set to have a plurality of priority queues.
Optionally, the MQTT protocol module is configured to have a high priority queue and a low priority queue.
Optionally, the MQTT protocol module is configured to send the messages in the high-priority queue first and send the messages in the low-priority queue only when the messages in the high-priority queue are empty.
Optionally, the MQTT protocol module is configured to determine whether to send the packet in a high-priority queue or a low-priority queue according to the priority flag in the packet.
Optionally, the protocol interaction packet of the MQTT protocol is marked as a high priority.
Optionally, the communication interaction device is a vehicle end.
The invention discloses a communication interaction method based on an MQTT protocol, which is characterized by comprising the following steps of:
a first judgment step of judging whether the message to be sent is high priority or low priority, if the message is high priority, adding the message into a high priority sending queue, otherwise, adding the message into a low priority queue;
a high priority queue sending step, which is used for sending the messages in the high priority sending queue; and
and a low-priority queue sending step, namely sending the messages in the low-priority queue when the messages in the high-priority queue are empty.
Optionally, in the first judging step, it is judged whether the message to be transmitted has a high priority or a low priority by judging the priority flag of the message to be transmitted.
Optionally, before sending the message, the method further comprises:
and a second judgment step, namely judging whether the number of the messages needing to be sent currently is less than the maximum allowable number of the messages being sent, if so, sending the messages, otherwise, marking the messages as invalid states and ending the process.
Optionally, after receiving the corresponding publish message from the server, the method further includes the following steps:
searching the messages in the queue, and deleting the messages from the message queue if the corresponding messages are found to indicate that the sending of the messages is finished;
sending a message marked as an invalid state in a high-priority sending queue; and
and when the message in the high-priority queue is empty, sending the message marked as the invalid state in the low-priority queue.
Optionally, the protocol interaction message of the MQTT protocol, the synchronization status message of the communication interaction device, and the reply message of the control command are marked as high priority.
The vehicle end of the invention comprises a memory and a processor, wherein the memory stores instructions, and when the processor executes the instructions, the communication interaction method based on the MQTT protocol is executed. Here, as an example, the vehicle end is, for example, an infotainment system of a vehicle.
The computer-readable medium of the present invention stores thereon a computer program, wherein the computer program is executed by a processor to implement the above-mentioned MQTT protocol-based communication interaction method.
The computer device of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and is characterized in that the processor implements the above communication interaction method based on MQTT protocol when executing the computer program.
As described above, according to the present invention, different priority queues can be established inside the mosquitto, high-priority, urgent messages (such as protocol interaction packets PING, SUBSCRIBE, UNSUBSRIBE messages, client status messages, reply messages of APP control commands, etc.) can be sent to the high-priority queues, and low-priority, non-urgent messages can be sent to the low-priority queues, so as to ensure that protocol communication is performed normally.
Other features and advantages of the methods and apparatus of the present invention will be more particularly apparent from or elucidated with reference to the drawings described herein, and the following detailed description of the embodiments used to illustrate certain principles of the invention.
Drawings
Fig. 1 is a block diagram of a MQTT protocol-based communication interaction system according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a communication interaction method based on MQTT protocol according to an embodiment of the present invention.
Fig. 3 is a flow chart showing a specific example of the MQTT protocol-based communication interaction method of the present invention.
Detailed Description
The following description is of some of the several embodiments of the invention and is intended to provide a basic understanding of the invention. It is not intended to identify key or critical elements of the invention or to delineate the scope of the invention.
Before explaining the MQTT protocol-based communication interaction system and the MQTT protocol-based communication interaction method of the present invention, contents related to the MQTT protocol are briefly explained.
MQTT (Message Queuing Telemetry Transport) is a "lightweight" communication protocol based on publish/subscribe (publish/subscribe) mode, which is built on TCP/IP protocol and published by IBM in 1999. The MQTT has the greatest advantage that a real-time reliable message service can be provided for connecting remote devices with few codes and limited bandwidth. The instant messaging protocol is low in cost and bandwidth occupation, and is widely applied to the aspects of Internet of things, small equipment, mobile application and the like.
Some concepts in the MQTT protocol are briefly explained here.
(1) Subscription (Subscription)
The subscription contains a Topic Filter (Topic Filter) and a maximum quality of service (QoS). A subscription may be associated with a Session (Session). A session may contain multiple subscriptions. Each subscription in each session has a different topic filter.
(2) Conversation (Session)
After each client establishes connection with the server, a session is formed, and the client and the server have state interaction. A session exists between one network and may span multiple continuous network connections between a client and a server.
(3) Subject Name (Topic Name)
A tag to connect to an application message, the tag matching the subscription of the server. The server will send a message to each client subscribing to the matched tag.
(4) Theme screener (Topic Filter)
A wildcard filter for topic names, used in the subscription expression, represents the plurality of topics matched by the subscription.
(5) Load (Payload)
Content specifically received by a message subscriber.
In addition, some methods (also called actions) are defined in the MQTT protocol to represent operations performed on certain resources. This resource may represent pre-existing data or dynamically generated data, depending on the implementation of the server. Generally, a resource refers to a file or output on a server. The main method comprises the following steps:
(1) connection: waiting for a connection to be established with a server;
(2) disconnection: waiting for the MQTT client to finish the work, and disconnecting the TCP/IP session with the server;
(3) subscriber: waiting for completion of subscription;
(4) UnSubscripte: waiting for the server to cancel one or more topics subscriptions of the client;
(5) publish: and the MQTT client sends a message request, and returns to the application program thread after the message request is sent.
When the MQTT protocol at the vehicle end is applied, an implementation library of the MQTT protocol is inevitably used, and the use of the mosquitto at the vehicle end is the best choice, because the MQTT protocol is completely implemented by the mosquitto, the cross-platform implementation is realized, the transplantation is easy, the structure is relatively clear, and the functions are relatively perfect. However, the mosquitto has some problems in the mobile network environment at the vehicle end under the conditions of weak network environment conditions (low bandwidth, high delay, network handover, network congestion).
For example, some messages that have not been published successfully before may start to be reissued, and later newly generated messages may be added to the sending queue, and at this time, a large number of reissued messages may appear in the queue, and if the messages are not important messages, the sending queue may be occupied, and at this time, some important messages may be generated, and in case of an urgent event, the sending queue may have an opportunity to send the messages only after the sending of the previous message is completed.
If the Qos of the low-priority message is =0, because it does not need to reply a publish ack, and such a message excessively occupies the transmission bandwidth of other messages, the mosquitto determines whether a connection exists and needs to depend on a PINGRSP packet, and a PING packet cannot be sent out due to blocking, thereby causing the mosquitto reconnect.
In order to solve the above problems, in the present invention, it is proposed to establish different priority queues inside the mosquitto, send high-priority messages, such as urgent messages (e.g., protocol interaction packets PING, SUBSCRIBE, UNSUBSRIBE messages, client status messages, reply messages of control commands of APP, etc.), to the high-priority queues, and send low-priority messages, such as non-urgent messages, to the low-priority queues, thereby ensuring that protocol communication is performed normally.
Fig. 1 is a block diagram of a MQTT protocol-based communication interaction system according to an embodiment of the present invention.
As shown in fig. 1, 100 denotes a vehicle end, which corresponds to "communication interaction device" in the claims, 200 is a carrier, 300 is a content Service Provider (TSP), and is generally implemented by a backend server, and 400 is a mobile terminal.
The software layer of the vehicle end 100 includes an application layer and a kernel layer, wherein a process module 110 is disposed on the application layer, a socket (socket) module 120 for connecting the application layer and the kernel layer is disposed between the application layer and the kernel layer, and the socket module 100 is configured to connect the process module 110 and the operator 200 through a wireless mobile network.
Specifically, the process module 110 includes: a message production module 111 and an MQTT protocol module 112. The message production module 111 is configured to organize and process different message packets through a plurality of threads, the MQTT protocol module 112 is configured to implement MQTT communication, and is also referred to as a mosquitto module, which is substantially an implementation library of an open-source MQTT protocol, and the mosquitto library is used to implement MQTT communication with a TCP socket (socket) of the content provider 200 in a long connection.
The content provider 300 provides various vehicle services, such as data monitoring, big data analysis, remote control of the vehicle, etc., and can provide a server-side platform for the MQTT of the vehicle. The mobile terminal 400 can perform data interaction with the content provider 300, acquire data of a vehicle, and query and control the vehicle.
The present invention is characterized in that in the MQTT protocol module 112 of the process module 110, a multi-level priority transmission queue is set, and specifically, for example, a high-low priority transmission queue, that is, a high-priority queue and a low-priority queue, may be set. The thread module 111 is configured to determine whether to send the packet in the high priority queue or in the low priority queue according to the priority flag in the packet.
After the process module 110 on the vehicle end establishes a connection with the content provider 200, protocol interaction messages (e.g., CONNECT, PINGREQ, PUBLISH, SUBSCRIBE, UNSUBSRIBE, DISCONNECT messages) inside the MQTT protocol module 112 and important messages of the process module 110 (e.g., synchronization status message PUBLISH (Qos >0) of the client, i.e., the vehicle end 100, and reply message PUBLISH (Qos >0) of the control command of the mobile terminal 300) are put into a high-priority sending queue of the MQTT protocol module 112 by the message production module 111 as high-priority messages, and other message messages are put into a low-priority sending queue of the MQTT protocol module 112 by the message production module 111.
Here, the message generation module 111 divides the messages to be transmitted into different priorities, wherein the synchronization status messages of the communication devices and the reply messages of the control commands are marked as high priority. On the other hand, the protocol interaction message of the MQTT protocol is processed by the MQTT protocol module 112 itself, and is automatically marked as a high priority.
Moreover, another feature of the present invention is that, in the MQTT protocol module 112, only when the messages in the high-priority transmission queue are empty, the messages in the low-priority queue are transmitted.
Due to the characteristics of the wireless mobile network: the mobile state network signal does not move stably, the time delay is high, the jitter and the packet loss are easy, the channel is narrow, and the access type and the access point change frequently. The characteristic of the wireless mobile determines the weak network performance, so the invention provides a sending queue with high and low priority aiming at the problem, thus the resource of socket can be allocated to important messages and messages as soon as possible when the wireless mobile network is recovered, thereby ensuring the normal operation of the whole connection system.
In the above description, the vehicle-side is taken as an example, but the communication interactive device of the present invention may be another communication interactive device that performs communication based on MQTT protocol other than the vehicle-side.
The communication interaction apparatus of the present invention is explained above, and then, the communication interaction method of the present invention is explained.
Fig. 2 is a flowchart illustrating a communication interaction method based on MQTT protocol according to an embodiment of the present invention.
As shown in fig. 2, in the communication interaction method based on MQTT protocol according to an embodiment of the present invention, the following steps are performed at the client (corresponding to the vehicle-side 100 in the above description):
first determination step S100: judging whether the message to be sent is high-priority or low-priority, if the message is high-priority, adding the message into a high-priority sending queue, otherwise, adding the message into a low-priority queue;
high priority queue sending step S200: sending the messages in the high-priority sending queue; and
low priority queue sending step S300: and when the message in the high-priority queue is empty, sending the message in the low-priority queue.
Wherein in the first judging step S100, whether the message to be transmitted is high priority or low priority is judged by judging the priority flag of the message to be transmitted.
Protocol interaction messages (such as CONNECT, PINGREQ, PUBLISH, SUBSCRIBE, UNSUBSRIBE, DISCONNECT messages) based on an MQTT protocol, important messages (such as a synchronous status message PUBLISH (Qos > 0)), and reply messages (such as a PUBLISH (Qos >0) from an external control command) are put into a high-priority sending queue, and other message messages are all put into a low-priority sending queue.
In the MQTT protocol-based communication interaction method according to an embodiment of the present invention, a second determining step (not shown) for determining whether the number of messages currently required to be sent is less than the maximum allowable number of messages being sent may be further provided. The second determining step may be provided before the information is transmitted. In the second step, it is determined whether the number of messages that need to be sent currently is less than the maximum number of messages that can be sent currently, if the determination result is less than the maximum number, the messages are sent, otherwise, the messages are marked as invalid and the process is ended.
In the MQTT protocol-based communication interaction method of the present invention, after receiving a corresponding publish message from a server (corresponding to the content provider 200), the method further includes the following steps:
searching the messages in the queue, and deleting the messages from the message queue if the corresponding messages are found to indicate that the sending of the messages is finished;
sending a message marked as an invalid state in a high-priority sending queue; and
and when the message in the high-priority queue is empty, sending the message marked as the invalid state in the low-priority queue.
Next, a specific example of the MQTT protocol-based communication interaction method according to the present invention will be described.
Fig. 3 is a flowchart showing a specific example of the MQTT protocol-based communication interaction method of the present invention.
As shown in fig. 3, in step S10, one MQTT message transmission is started (star).
In step S11, the validity of the topic (topic) is determined, and if it is valid, the flow proceeds to step S12.
In step 12, msgid is generated by mosquitto _ mid _ generate, and is the identification of the message for confirmation of the message distribution.
In step 13, a message object is generated and assigned an attribute, such as a high priority flag or a low priority flag.
In step S14, the priority flag of the message is checked during transmission, and whether the priority of the message is high is determined, if the priority of the message is high, the process proceeds to step S15, the message is placed in a high-priority message transmission queue, i.e., high _ out _ messages in fig. 3, otherwise, the process proceeds to step S16, the message is placed in a low-priority message transmission queue, i.e., out _ messages in fig. 3, where the process is one of the differences from the existing mosquito. (here we take Qos =1 as an example).
In step S17, it is detected whether the number of messages that need to be sent currently is less than the allowable number of messages that are being sent, that is, it is determined in fig. 3 whether inflight _ messages is less than max _ inflight _ messages, if so, the process proceeds to step S18, and if not, the process proceeds to step S20.
In step S20, since the number of messages that need to be sent exceeds the allowable number of messages being sent, which indicates that the message interaction confirmation message sent by the mosquitto control exceeds the set value, the message is directly marked as invalid, i.e., "the marking information is mosq _ ms _ invalid" in fig. 3, and then the process returns to the stop (stop) step S21.
In step S18, since the determination result is less than the set value, it indicates that it is possible to continue sending messages to the server, and therefore, the PUBLISH protocol package operation is performed and step S19 is continued.
In step S19, a packet transmission flow is performed.
On the other hand, in step S30, the mosquitto _ packet _ read in fig. 3, which is the corresponding publish message received from the server, is read.
In step S31, if the message in the message queue, i.e., the message _ handle _ feedback in fig. 3, is searched for by the msgid and found to indicate that the transmission of the message is completed, in step S32, the message in the message queue, i.e., the message _ remove in fig. 3, is deleted from the message queue and the message is transmitted to the message queue buffered before.
In step S33, the message in the high-priority transmission queue (i.e., the message marked as invalid in the high-priority queue) is transmitted first, i.e., the message whose invalid state is proposed from the high-priority message transmission queue high _ out _ messages in fig. 3, i.e., mosq _ ms _ invalid, is transmitted.
In step S34, the message in the low priority transmission queue (i.e. the message marked as invalid state in the low priority queue) is transmitted again, i.e. when the high priority queue is empty in fig. 3, the message that proposes invalid state from the low priority queue out _ messages, i.e. mosq _ ms _ invalid, is transmitted.
In step S35, it is determined whether the number of messages that need to be sent currently is less than the allowable number of messages that are being sent, that is, it is determined whether inflight _ messages is less than max _ inflight _ messages in fig. 3, if so, the process proceeds to step S18, and if not, the process proceeds to step S21.
In the MQTT protocol-based communication interaction system and the MQTT protocol-based communication interaction method, a mosquitto agent module in a vehicle terminal adopts a high-priority and low-priority sending queue to enter urgent messages (such as protocol interaction packages PING, SUBSCRIBE, UNSUBSRIBE messages, client state messages and reply messages of APP control commands) into the high-priority sending queue, and adds low-priority messages (such as non-urgent and unimportant messages) into the low-priority sending queue. Therefore, the method can improve the communication between the client (vehicle end) and the server (such as a content provider), and can keep connection even in a weak network environment, thereby effectively reducing the occurrence of the situation that reconnection and the state cannot be quickly synchronized. Particularly, the problem that the low-priority and non-urgent messages occupy the sending bandwidth of other messages under a weak network environment at the vehicle end to cause that the high-priority, protocol messages and urgent messages cannot be sent out, so that the mosquitto reconnection and the vehicle end state cannot be quickly synchronized can be solved.
The invention further provides a vehicle end, which comprises a memory and a processor, wherein the memory stores instructions, and when the processor executes the instructions, the communication interaction method based on the MQTT protocol is executed.
The present invention also provides a computer readable medium, on which a computer program is stored, wherein the computer program is implemented by a processor to implement the above-mentioned MQTT protocol-based communication interaction method.
The invention also provides a computer device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, and is characterized in that the processor implements the communication interaction method based on the MQTT protocol when executing the computer program.
The above examples mainly illustrate the MQTT protocol-based communication interaction system and the MQTT protocol-based communication interaction method of the present invention. Although only a few embodiments of the present invention have been described in detail, those skilled in the art will appreciate that the present invention may be embodied in many other forms without departing from the spirit or scope thereof. Accordingly, the present examples and embodiments are to be considered as illustrative and not restrictive, and various modifications and substitutions may be made therein without departing from the spirit and scope of the present invention as defined by the appended claims.

Claims (14)

1. A communication interaction device based on MQTT protocol is characterized by being provided with a process module, wherein the process module comprises:
the message production module is used for organizing and processing different message messages through a plurality of threads; and
an MQTT protocol module used for realizing MQTT communication,
the MQTT protocol module is set to have a plurality of priority queues.
2. The MQTT protocol-based communication interaction device of claim 1,
the MQTT protocol module is set to have a high-priority queue and a low-priority queue.
3. The MQTT protocol-based communication interaction device of claim 1,
the MQTT protocol module is set to firstly send the messages in the high-priority queue and only send the messages in the low-priority queue when the messages in the high-priority queue are empty.
4. The MQTT protocol-based communication interaction device of claim 1,
the message production module is set to judge whether the message is put in the high-priority queue of the MQTT protocol module or the low-priority queue of the MQTT protocol module according to the priority mark in the message.
5. The MQTT protocol-based communication interaction device of claim 4,
the message production module marks the synchronous state message of the communication interaction device and the reply message of the control command as high priority, and the MQTT protocol module marks the protocol interaction message of the MQTT protocol as high priority.
6. The MQTT protocol-based communication interaction device of any of the claims 1 to 5,
the communication interaction device is a vehicle end.
7. A communication interaction method based on MQTT protocol is characterized by comprising the following steps:
a first judgment step of judging whether the message to be sent is high priority or low priority, if the message is high priority, adding the message into a high priority sending queue, otherwise, adding the message into a low priority queue;
a high priority queue sending step, which is used for sending the messages in the high priority sending queue; and
and a low-priority queue sending step, namely sending the messages in the low-priority queue when the messages in the high-priority queue are empty.
8. The MQTT protocol-based communication interaction method of claim 7,
in the first judgment step, it is judged whether the message to be transmitted is high priority or low priority by judging the priority flag of the message to be transmitted.
9. The MQTT protocol-based communication interaction method of claim 8,
before sending the message, the method further comprises:
and a second judgment step, namely judging whether the number of the messages needing to be sent currently is less than the maximum allowable number of the messages being sent, if so, sending the messages, otherwise, marking the messages as invalid states and ending the process.
10. The MQTT protocol-based communication interaction method of claim 9, wherein, after receiving the corresponding release acknowledgement message from the server, further comprising the steps of:
searching the messages in the queue, and deleting the messages from the message queue if the corresponding messages are found through the message identifiers to indicate that the sending of the messages is finished;
sending a message marked as an invalid state in a high-priority sending queue; and
and when the message in the high-priority queue is empty, sending the message marked as the invalid state in the low-priority queue.
11. The MQTT protocol-based communication interaction method of claim 8,
and marking the protocol interaction message of the MQTT protocol, the synchronous state message of the communication interaction device and the reply message of the control command as high priority.
12. A vehicle end comprising a memory and a processor, wherein the memory stores instructions, and when the processor executes the instructions, the MQTT protocol-based communication interaction method according to any one of claims 7 to 11 is executed.
13. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, implements the MQTT protocol-based communication interaction method according to any one of claims 7 to 11.
14. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the MQTT protocol-based communication interaction method according to any one of claims 7 to 11 when executing the computer program.
CN201811009545.3A 2018-08-31 2018-08-31 MQTT protocol-based communication interaction method and communication interaction system Pending CN110875887A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811009545.3A CN110875887A (en) 2018-08-31 2018-08-31 MQTT protocol-based communication interaction method and communication interaction system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811009545.3A CN110875887A (en) 2018-08-31 2018-08-31 MQTT protocol-based communication interaction method and communication interaction system

Publications (1)

Publication Number Publication Date
CN110875887A true CN110875887A (en) 2020-03-10

Family

ID=69715812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811009545.3A Pending CN110875887A (en) 2018-08-31 2018-08-31 MQTT protocol-based communication interaction method and communication interaction system

Country Status (1)

Country Link
CN (1) CN110875887A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112134758A (en) * 2020-09-22 2020-12-25 上海茂声智能科技有限公司 Method and device for monitoring weak network environment and reconnecting communication session
CN112333115A (en) * 2020-08-19 2021-02-05 深圳Tcl新技术有限公司 Data transmission method, terminal device, server and storage medium
CN113392083A (en) * 2021-05-25 2021-09-14 交控科技股份有限公司 Rail transit equipment log processing system and method
CN113965482A (en) * 2021-10-19 2022-01-21 北京天融信网络安全技术有限公司 Data transmission method and device based on gRPC and storage medium
CN114095589A (en) * 2021-12-29 2022-02-25 诺领科技(南京)有限公司 Coexistence processing method and system for multiple communication systems of Internet of things chip
CN114866504A (en) * 2022-03-25 2022-08-05 安徽南瑞中天电力电子有限公司 Communication method between processes of energy controller based on MQTT message protocol

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148275A1 (en) * 2006-10-30 2008-06-19 Alexander Krits Efficient Order-Preserving Delivery of Concurrent Messages
CN101222436A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Graded data transmission method
WO2014201934A1 (en) * 2013-06-21 2014-12-24 中兴通讯股份有限公司 Message scheduling method and device
CN106657397A (en) * 2017-02-14 2017-05-10 深圳市沃特玛电池有限公司 Internet of Vehicles based on MQTT protocol
US20170279874A1 (en) * 2016-03-23 2017-09-28 Sap Se Translation of messages using sensor-specific and unified protocols

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148275A1 (en) * 2006-10-30 2008-06-19 Alexander Krits Efficient Order-Preserving Delivery of Concurrent Messages
CN101222436A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Graded data transmission method
WO2014201934A1 (en) * 2013-06-21 2014-12-24 中兴通讯股份有限公司 Message scheduling method and device
US20170279874A1 (en) * 2016-03-23 2017-09-28 Sap Se Translation of messages using sensor-specific and unified protocols
CN106657397A (en) * 2017-02-14 2017-05-10 深圳市沃特玛电池有限公司 Internet of Vehicles based on MQTT protocol

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112333115A (en) * 2020-08-19 2021-02-05 深圳Tcl新技术有限公司 Data transmission method, terminal device, server and storage medium
CN112333115B (en) * 2020-08-19 2024-02-09 深圳Tcl新技术有限公司 Data transmission method, terminal device, server and storage medium
CN112134758A (en) * 2020-09-22 2020-12-25 上海茂声智能科技有限公司 Method and device for monitoring weak network environment and reconnecting communication session
CN113392083A (en) * 2021-05-25 2021-09-14 交控科技股份有限公司 Rail transit equipment log processing system and method
CN113965482A (en) * 2021-10-19 2022-01-21 北京天融信网络安全技术有限公司 Data transmission method and device based on gRPC and storage medium
CN114095589A (en) * 2021-12-29 2022-02-25 诺领科技(南京)有限公司 Coexistence processing method and system for multiple communication systems of Internet of things chip
CN114866504A (en) * 2022-03-25 2022-08-05 安徽南瑞中天电力电子有限公司 Communication method between processes of energy controller based on MQTT message protocol
CN114866504B (en) * 2022-03-25 2024-02-23 安徽南瑞中天电力电子有限公司 Communication method between energy controller processes based on MQTT message protocol

Similar Documents

Publication Publication Date Title
CN110875887A (en) MQTT protocol-based communication interaction method and communication interaction system
CN108124003B (en) Network management equipment connection processing method, device and system
US20190268797A1 (en) Data transmission method and apparatus
CN110808948B (en) Remote procedure calling method, device and system
EP3481028B1 (en) Thread-based tcp packet processing
CN105635083A (en) Service processing method and service processing system based on server and client architecture
CN111522663B (en) Data transmission method, device and system based on distributed storage system
CN115002016B (en) Message processing system, method, device and storage medium
CN113438169A (en) Data scheduling method, electronic equipment and storage medium
US10348840B2 (en) Dynamic workflow control between network entities
CN110808917B (en) Multilink aggregation data retransmission method and transmitting equipment
US20090172122A1 (en) Message Transmission Method, Message Transmission Device, and Storage Medium Recorded with Message Transmission Program
CN115865886B (en) HTTP-based cross-network data interaction method and device
CN107819855A (en) A kind of message distributing method and device
CN104348711A (en) Apparatus and method for receiving messages
CN112367265B (en) Reliable data transmission method and device suitable for narrow-band weak connection network
US11444880B2 (en) Traffic control method and related apparatus
CN113438218A (en) Communication method and device based on SOME/IP protocol, storage medium and terminal
CN113904994A (en) Method for uniformly reporting big data of home gateway to platform
US20220006735A1 (en) Network device and packet processing method using same
CN113454959A (en) Control plane network function, user plane network function, and packet processing method using the same
CN111130968A (en) Method and terminal for solving Modbus bus communication packet sticking
CN114584566A (en) Data processing method, device and equipment based on message queue and storage medium
CN111885198B (en) Message processing method, system and device and electronic setting
US20230156768A1 (en) Method and device for stopping sending schedule request

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200807

Address after: Susong Road West and Shenzhen Road North, Hefei Economic and Technological Development Zone, Anhui Province

Applicant after: Weilai (Anhui) Holding Co.,Ltd.

Address before: 30 Floor of Yihe Building, No. 1 Kangle Plaza, Central, Hong Kong, China

Applicant before: NIO NEXTEV Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200310