Method, device and storage apparatus for supporting data processing of mqtt communication protocol

By adding a data processing module and feedback control messages to the MQTT Broker, the problem of the MQTT protocol's inability to process data is solved, enabling data processing and real-time reliable data transmission to meet personalized application needs.

CN115623033BActive Publication Date: 2026-03-27SUZHOU SICUI IND INTERNET TECH RES INST CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The existing MQTT communication protocol can only meet the data forwarding service in the Internet of Things, and cannot meet the personalized application scenarios that require data processing and data forwarding.

Method used

Add data processing functionality to the MQTT Broker role, including dirty data filtering and data transformation modules, and feed back the data processing results to the MQTT Publisher role through feedback control messages. Adopt a modular and integrated processing approach, and allow users to customize data processing rules.

Benefits of technology

It avoids duplicate data processing for each MQTT subscriber, reduces the time consumed by dirty data during transmission, provides data processing services and real-time reliable data transmission, and meets users' personalized application needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115623033B_ABST
    Figure CN115623033B_ABST
Patent Text Reader

Abstract

The application particularly relates to an MQTT communication protocol method, device and storage device supporting data processing. The MQTT communication protocol method, device and storage device supporting data processing add a data processing module to an MQTT Broker role, and feed back data processing results to an MQTT publisher role through newly-added feedback control messages; the data processing module is used for realizing dirty data filtering, data conversion and feedback functions; the MQTT publisher role adjusts dirty data after receiving feedback information, and re-reports data. The MQTT communication protocol method, device and storage device supporting data processing not only can avoid repeated data processing work of each MQTT subscriber, but also can avoid time consumption of dirty data in the whole MQTT transmission process, feed back dirty data to the publisher in time, and thus can effectively meet individualized MQTT application scene requirements of users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data communication, in particular to an MQTT communication protocol method supporting data processing, equipment and storage device. BACKGROUND

[0002] MQTT (Message Queuing Telemetry Transport) is a lightweight protocol based on publish / subscribe mode. The protocol is built on TCP / IP protocol, and the greatest advantage of MQTT is that it can provide real-time and reliable message service for connecting remote devices with very little code and limited bandwidth. As a low-cost and low-bandwidth instant messaging protocol, it has a wide range of applications in Internet of Things, small devices, mobile applications and other fields.

[0003] MQTT supports three kinds of message publishing service quality: "at most once", message publishing completely depends on the underlying TCP / IP network, and message loss or repetition may occur. This level can be used in the following cases: environmental sensor data, loss of data record once will not cause data loss, because there will be a second transmission soon. This way is mainly used for ordinary APP push. If the smart device is not connected when the message is pushed, the push will not be received, and it will not be received again when it is connected. "At least once", ensure that the message arrives, but message repetition may occur. "Only once", ensure that the message arrives once. In some more stringent billing systems, this level can be used. In the billing system, message repetition or loss will lead to incorrect results. This highest quality message publishing service can also be used for instant messaging type APP push, to ensure that the user receives it and only receives it once.

[0004] Since the MQTT communication protocol is built on the TCP / IP protocol, it follows the message transmission mode of the message; the composition of the MQTT message: fixed header, variable header and payload;

[0005] Table 1 Fixed header: every message has

[0006]

[0007] Table 2 Variable header: some messages have

[0008]

[0009]

[0010] Payload (part of the message contains): generally length + specific information in hexadecimal representation; the maximum length is limited by the remaining length of 4 bytes in the fixed header (i.e. the maximum amount of information carried by information is 4 bytes: 256MB); different messages carry different payloads, for example, the CONNECT message is: user id length + user id + username length + username + user password length + user password.

[0011] Table 3 Existing control messages in MQTT communication protocol

[0012]

[0013]

[0014] Table 4 Existing MQTT communication protocol for variable messages and payloads

[0015]

[0016] The following is described with a specific example:

[0017]

[0018]

[0019] PUBLISH message display (hexadecimal representation):

[0020] MQTT control message type: 30

[0021] Remaining length: 11

[0022] Theme length: 00 04

[0023] Theme details: 74 65 73 74

[0024] Carry effective information: 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0025] Overall message: 30 11 00 04 74 65 73 74 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0026] With the continuous development of Internet of Things technology, the application of MQTT communication protocol is also more and more widely; the original MQTT communication protocol can only meet the data original forwarding service in Internet of Things, and cannot meet some personalized application scenarios which need to support data processing and data forwarding.

[0027] Based on this, the application provides an MQTT communication protocol method, equipment and storage device supporting data processing. SUMMARY

[0028] The application provides an MQTT communication protocol method, equipment and storage device supporting data processing, which overcomes the defects of the prior art.

[0029] The application is implemented through the following technical solutions:

[0030] An MQTT communication protocol method supporting data processing, characterized in that: an MQTT Broker role is added with a data processing function, and a data processing result is fed back to an MQTT publisher role through an added feedback control message.

[0031] The MQTT Broker role is added with a data processing module in addition to the basic functions of the existing MQTT communication protocol, and the data processing module is used to realize dirty data filtering, data conversion and feedback functions.

[0032] A data processing package is added in the underlying implementation code of the MQTT Broker, a modular integration processing mode is adopted, and a user imports a data processing configuration file; the MQTT Broker role determines whether to start a related data processing function according to the data processing file configured by the user; if the data processing function is not started, the existing MQTT communication protocol is used; if the data processing function is started, dirty data filtering rules and corresponding data conversion rules are customized and configured.

[0033] After the MQTT Broker role completes data processing, the processed data is forwarded to an MQTT subscriber role by using the data forwarding function of the MQTT; meanwhile, the result of the data processing is fed back to the MQTT publisher role through an added feedback message feedback, and the MQTT publisher role adjusts dirty data and re-reports data after receiving the feedback information.

[0034] The MQTT publisher role is deployed in an MQTT client, is a router in the Internet of Things, is connected with intelligent edge devices, collects related data of the intelligent edge devices, and reports the data as original data of MQTT data transmission.

[0035] The MQTT subscriber role is deployed in the MQTT client, receives data forwarded from the MQTT Broker by subscribing to a topic topic agreed with the MQTT publisher.

[0036] The feedback message feedback includes a fixed message header and a payload, and the message is shown as F0+remaining length+payload. A feedback flag is newly added to determine whether the publisher receives the feedback message.

[0037] The method comprises the following steps:

[0038] Step S01, MQTT client connects to the server

[0039] After the publisher with the installed MQTT client establishes a network connection with the MQTT Broker, the publisher sends a CONNECT message to request to establish a connection with the server.

[0040] In the same network connection, the client can only send one CONNECT message. If a second CONNECT message appears, according to the protocol standard, the server will treat the second CONNECT message as a protocol violation and disconnect the client connection. For a normal connection request, the server must generate a response message CONNACK. If the session cannot be established, the server reports the corresponding error code in the response message.

[0041] After the client and the server successfully establish a connection, in order to maintain the connection, the client sends a heartbeat request message PINGREQ to the server every t seconds according to the time value t set in the CONNECT message. Similarly, when the server receives the client heartbeat request, the server replies with a heartbeat response message PINGRESP.

[0042] Step S02, MQTT subscribes to the topic

[0043] After the MQTT subscriber installs the MQTT client, the subscriber sends a SUBSCRIBE message to the server to create one or more subscriptions. The SUBSCRIBE message contains the subscription topic and the maximum quality of service QoS level allowed by the server to send application messages to the client: 0, 1 or 2. After receiving the SUBSCRIBE message, the server replies with a SUBACK confirmation message. At the same time, the server records one or more topics that each client is interested in. When the server receives the PUBLISH message of these topics, the server distributes the application message to the matching client.

[0044] Step S03, MQTT publishes the topic

[0045] After the MQTT publisher installs the MQTT client, the publisher sends a PUBLISH message to the server for data reporting. The PUBLISH message contains a fixed message header, a payload, and a message quality of service QoS level: 0, 1 or 2. According to the message quality of service level and whether the user enables the data processing function, the message is transmitted.

[0046] Step S04, MQTT topic forwarding

[0047] First, the existing MQTT server (Broker) underlying function module is integrated with the original function, receives network connection from the client, and processes the message subscription and message publishing request of the client, and forwards the message published by the MQTT publisher to the message subscription client, and adds data processing function;

[0048] Step S05, when the MQTT Broker receives the data uploaded by the MQTT publisher, according to the data processing configuration document imported by the user, it is decided whether to start the data processing function;

[0049] If the data processing function is not started, it is the existing MQTT communication protocol, and the corresponding message transmission is carried out according to the QoS value in the PUBLISH message;

[0050] Step S06, if the data processing function is started, the user customizes the data processing rules, including the dirty data filtering rules and the data conversion rules, and processes the data received from the MQTT publisher according to the data processing rules, and calls the MQTT communication protocol to forward the normal data to the message subscription client;

[0051] Step S07, MQTT unsubscribes the topic, the subscriber of the MQTT client sends the unsubscribe message to the server to cancel the subscription topic;

[0052] Step S08, MQTT disconnects

[0053] The MQTT client sends the disconnect message to the server, indicating that the client is normally disconnected.

[0054] In step S03, if the user starts the data processing function, the server determines whether to feed back the data processed information to the MQTT publisher through the feedback message feedback according to whether the PUBLISH message receives the feedback flag bit; if the feedback flag bit is received, the feedback information is sent back, otherwise no feedback.

[0055] In step S06, first, the MQTT Broker processes the data received from the MQTT publisher according to the dirty data filtering rules configured by the user, feeds back the dirty data to the MQTT publisher in the feedback message feedback mode, and provides the information feedback function; second, for the filtered normal data, the data conversion rules configured by the user are used for data conversion; finally, the MQTT communication protocol is called to forward the data converted according to the data conversion rules configured by the user to the message subscription client.

[0056] The unsubscribe message contains the information of the topic to be unsubscribed.

[0057] An apparatus comprising a memory and a processor, wherein the memory is configured to store a computer program, and the processor is configured to implement the method steps when executing the computer program.

[0058] A readable storage medium, wherein the readable storage medium stores a computer program, and the computer program is configured to implement the method steps when executed by a processor.

[0059] The MQTT communication protocol method, device and storage device supporting data processing have the advantages that the MQTT communication protocol method, device and storage device supporting data processing can not only avoid repeated data processing work of each MQTT subscriber, but also avoid time consumption of dirty data in the whole MQTT transmission process, and can feed back the dirty data to the publisher in time, so that limited bandwidth can be used to provide data processing service and real-time and reliable data transmission service for connected remote devices, and the personalized MQTT application scene demand of users can be effectively met. BRIEF DESCRIPTION OF DRAWINGS

[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0061] FIG. 1 is a flowchart of the existing MQTT communication protocol. Figure 1 FIG. 1 is a flowchart of the existing MQTT communication protocol.

[0062] FIG. 2 is a flowchart of the MQTT communication protocol supporting data processing according to the present application. Figure 2 FIG. 2 is a flowchart of the MQTT communication protocol supporting data processing according to the present application.

[0063] FIG. 3 is a specific flowchart of the data processing module added to the existing MQTT communication protocol according to the present application. Figure 3 FIG. 3 is a specific flowchart of the data processing module added to the existing MQTT communication protocol according to the present application.

[0064] FIG. 4 is a specific work flowchart of the MQTT communication protocol supporting data processing according to the present application. Figure 4 FIG. 4 is a specific work flowchart of the MQTT communication protocol supporting data processing according to the present application. DETAILED DESCRIPTION

[0065] In order to make the person skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in combination with the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.

[0066] The MQTT communication protocol method supporting data processing adds a data processing function to the MQTT Broker role, and feeds back the data processing result to the MQTT publisher role through a newly added feedback control message;

[0067] In addition to the basic functions of the existing MQTT communication protocol (receiving network connection from the client, processing message subscription and message publishing request of the client, and forwarding the message published by the MQTT publisher to the message subscription client), the MQTT Broker role adds a data processing module, which is used to realize the functions of dirty data filtering, data conversion and feedback;

[0068] A data processing package is added to the underlying implementation code of the MQTT Broker, and a modular integration processing method is adopted. The user imports a data processing configuration file. The MQTT Broker role determines whether to start the related data processing (dirty data filtering, data conversion) function according to the user's configured data processing file. If the data processing function is not started, it is the existing MQTT communication protocol. If the data processing function is started, the dirty data filtering rule and the corresponding data conversion rule are customized;

[0069] After the MQTT Broker role completes the data processing, it uses the data forwarding function of MQTT to forward the processed data to the MQTT subscriber role. At the same time, the result of the data processing is fed back to the MQTT publisher role through the newly added feedback message feedback. After receiving the feedback information, the MQTT publisher role adjusts the dirty data and re-reports the data.

[0070] The feedback message feedback refers to the composition of the PUBLISH message, including a fixed message header and a payload. The specific value uses the reserved field (Reserved) 15 in the existing control message in the MQTT communication protocol in Table 3: the message display of the feedback message feedback is F0+remaining length+payload. At the same time, a flag bit is added to the existing publishing message PUBLISH: whether the publisher receives the feedback message (modified publishing message format: fixed header+whether to receive feedback flag+payload).

[0071] The MQTT publisher role is deployed in the MQTT client and is a router with specific functions in the Internet of Things, and the intelligent edge devices such as intelligent sensors, intelligent cars, intelligent charging piles, intelligent photovoltaic devices, intelligent kitchen utensils and the like are connected thereto; the intelligent edge devices collect relevant data as original data for MQTT data transmission and report the same.

[0072] The MQTT subscriber role is deployed in the MQTT client and receives the data forwarded from the MQTT Broker by subscribing to the topic agreed with the MQTT publisher.

[0073] The data forwarded by the MQTT Broker is generally a data input module of a certain system in the Internet of Things, and some data processing platform systems such as a digital energy management platform are connected thereto.

[0074] The method comprises the following steps:

[0075] Step S01, the MQTT client connects the server

[0076] After the publisher of the MQTT client establishes a network connection with the MQTT Broker, the CONNECT message is sent to request the establishment of a connection with the server;

[0077] In the same network connection, the client can only send one CONNECT message, and if a second CONNECT message appears, according to the protocol standard, the server will treat the second CONNECT message as a protocol violation and disconnect the connection of the client; for a normal connection request, the server must generate a response message CONNACK, and if a session cannot be established, the server reports the corresponding error code in the response message;

[0078] After the client and the server successfully establish a connection, in order to maintain the connection, according to the time value t set in the CONNECT message, the client sends a heartbeat request message PINGREQ to the server every t seconds; similarly, when the server receives the heartbeat request of the client, it replies with a heartbeat response message PINGRESP;

[0079] Step S02, MQTT subscribes to the topic

[0080] MQTT subscriber sends SUBSCRIBE packet to server after installing MQTT client to create one or more subscriptions, SUBSCRIBE packet contains subscription topics and the maximum QoS level allowed by the server to send application messages to the client: 0, 1 or 2; the server end receives the SUBSCRIBE packet and replies with a SUBACK confirmation packet; at the same time, the server records one or more topics that each client is interested in, and when the server receives the PUBLISH packet of these topics, it will distribute the application message to the matching client;

[0081] Step S03, MQTT publish topic

[0082] MQTT publisher sends PUBLISH packet to server after installing MQTT client for data reporting, PUBLISH packet contains fixed packet header, payload (topic name and reported data set) and message quality of service QoS level: 0, 1 or 2; according to the message quality of service level and whether the user enables data processing function, the message transmission is carried out;

[0083] Step S04, MQTT topic forwarding

[0084] First, the existing MQTT server (Broker) adopts the basic function module to integrate the original function, receives network connection from the client, processes the message subscription and message publishing request of the client, forwards the message published by the MQTT publisher to the message subscription client, and adds the data processing function;

[0085] Step S05, when MQTT Broker receives the data uploaded by MQTT publisher, according to the data processing configuration document imported by the user, it is decided whether to enable the data processing function;

[0086] If the data processing function is not enabled, it is the existing MQTT communication protocol, and the corresponding message transmission is carried out according to the QoS value in the PUBLISH packet;

[0087] Step S06, if the data processing function is enabled, the user customizes the data processing rules, including dirty data filtering rules and data conversion rules, and processes the data received from the MQTT publisher according to the data processing rules, and calls the MQTT communication protocol to forward the normal data to the message subscription client;

[0088] Step S07, MQTT unsubscribes the topic, the subscriber installs the MQTT client and sends unsubscribe packet to the server to cancel the subscription topic;

[0089] Step S08, MQTT disconnects

[0090] The MQTT client (publisher / subscriber) sends a disconnect packet to the server, indicating that the client is normally disconnected.

[0091] In step S03, if the user has opened the data processing function, the server determines whether to feed back the information processed by the data to the MQTT publisher through the feedback packet feedback according to whether the feedback flag bit of the PUBLISH packet is received; if the feedback flag bit is received, the feedback information is sent back, otherwise no feedback is made.

[0092] The process of message transmission of the PUBLISH control packet with the message quality of service QoS level of 0 is as follows:

[0093] I: As shown in the accompanying Figure 1 The existing MQTT communication protocol is shown in the accompanying

[0094] II: As shown in the accompanying Figure 2 If the user has opened the data processing function, the server determines whether to feed back the information processed by the data to the MQTT publisher through the feedback packet feedback according to whether the feedback flag bit of the PUBLISH packet is received.

[0095] The process of message transmission of the PUBLISH control packet with the message quality of service QoS level of 1 is as follows:

[0096] I: As shown in the accompanying Figure 1 The existing MQTT communication protocol is shown in the accompanying

[0097] II: As shown in the accompanying Figure 2 If the user has opened the data processing function, the server determines whether to feed back the information processed by the data to the MQTT publisher through the feedback packet feedback according to whether the feedback flag bit of the PUBLISH packet is received.

[0098] The process of message transmission of the PUBLISH control packet with the message quality of service QoS level of 2 is as follows:

[0099] I: As shown in the accompanying Figure 1As shown in the existing MQTT communication protocol for QoS2 PUBLISH message; MQTT publisher will store the message locally before sending the PUBLISH message to the server; the server will reply with a PUBLISH message PUBREC after receiving the PUBLISH message, indicating that the message has been received; the MQTT publisher will send a PUBREL release message after receiving the PUBREC message, and the server will reply with a PUBCOM completion message after receiving the PUBREL release message. The MQTT publisher deletes the message after receiving the completion message PUBCOM, indicating the end of this publishing behavior.

[0100] II: As shown in the attached Figure 2 As shown, if the user enables the data processing function, the MQTT publisher will store the message locally before sending the PUBLISH message to the server; the server will reply with a PUBLISH message PUBREC after receiving the PUBLISH message, indicating that the message has been received; the MQTT publisher will send a PUBREL release message after receiving the reply PUBREC message; the server will reply with a PUBCOM completion message after receiving the PUBREL release message, and the MQTT publisher will delete the message after receiving the completion message PUBCOM; the server will determine whether to feed back the processed information to the MQTT publisher through the feedback message according to the PUBLISH message feedback flag.

[0101] In step S06, first, the MQTT Broker processes the data received from the MQTT publisher according to the user-configured dirty data filtering rules, feeds back the filtered dirty data to the MQTT publisher in the form of a feedback message, and provides information feedback function; second, for the filtered normal data, data conversion is performed according to the user-configured data conversion rules; finally, the data converted according to the user-configured data conversion rules is forwarded to the message subscription client by calling the MQTT communication protocol.

[0102] The unsubscribe message contains the topic information of the subscription to be canceled.

[0103] Embodiment 1:

[0104]

[0105] Modified PUBLISH message display (hexadecimal representation):

[0106] MQTT control message type: 30

[0107] Remaining length: 12

[0108] Receiving feedback flag (00 means receiving, 01 means not receiving): 00

[0109] Topic length: 00 04

[0110] Topic details: 74 65 73 74

[0111] Carrying effective information: 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0112] Overall packet: 30 12 00 00 04 74 65 73 74 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0113]

[0114]

[0115] MQTT control packet type: f0

[0116] Remaining length: 11

[0117] Topic length: 00 04

[0118] Topic details: 74 65 73 74

[0119] Carrying effective information: 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0120] Overall packet: f0 11 00 04 74 65 73 74 68 65 6c 6c 6f 20 77 6f 72 6c 64

[0121] The device comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to execute the computer program to realize the method steps.

[0122] The readable storage medium has a computer program stored thereon, and the computer program is executed by the processor to realize the method steps.

[0123] The above-described embodiments are only one of the specific embodiments of the present application, and the usual changes and replacements made by those skilled in the art within the scope of the technical solutions of the present application should be included in the protection scope of the present application.

Claims

1. A method for supporting MQTT communication protocol for data processing, characterized in that: The MQTT Broker role adds a data processing function and feeds back the data processing result to the MQTT publisher role through a newly added feedback control message; The MQTT Broker role adds a data processing module to the existing MQTT communication protocol, which is used to realize the functions of dirty data filtering, data conversion and feedback; In the MQTT Broker underlying implementation code, a data processing package is added, and a modular integration processing method is adopted. A user imports a data processing configuration file. The MQTT Broker role determines whether to start the related data processing function according to the user's data processing file. If the data processing function is not started, it is the existing MQTT communication protocol. If the data processing function is started, the dirty data filtering rules and corresponding data conversion rules are customized; After the MQTT Broker role completes the data processing, it uses the data forwarding function of MQTT to forward the processed data to the MQTT subscriber role. At the same time, the result of the data processing is fed back to the MQTT publisher role through the newly added feedback message feedback. After receiving the feedback information, the MQTT publisher role adjusts the dirty data and re-reports the data. The method comprises the following steps: Step S01, connecting the server by the MQTT client After the publisher of the MQTT client establishes a network connection with the MQTT Broker, the CONNECT message is sent to request the establishment of a connection with the server; In the same network connection, the client can only send one CONNECT message. If a second CONNECT message appears, according to the protocol standard, the server will treat the second CONNECT message as a protocol violation and disconnect the client connection. For a normal connection request, the server must generate a response message CONNACK. If the session cannot be established, the server reports the corresponding error code in the response message; After the client and the server successfully establish a connection, in order to maintain the connection, the client sends a heartbeat request message PINGREQ to the server every t seconds according to the time value t set in the CONNECT message; Similarly, when the server receives the client heartbeat request, it replies with a heartbeat response message PINGRESP; Step S02, subscribing to the topic by the MQTT After the MQTT subscriber installs the MQTT client, it sends a SUBSCRIBE message to the server to create one or more subscriptions. The SUBSCRIBE message contains the subscription topic and the maximum service quality QoS level allowed by the server to send application messages to the client: 0, 1 or 2. The server replies with a SUBACK confirmation message after receiving the SUBSCRIBE message. At the same time, the server records one or more topics that each client is interested in. When the server receives the PUBLISH message of these topics, it will distribute the application message to the matching client; Step S03, publishing the topic by the MQTT The MQTT publisher sends a PUBLISH packet to the server for data reporting after installing the MQTT client, and the PUBLISH packet contains a fixed packet header, a payload, and a message service quality QoS level: 0, 1, or 2; according to the message service quality level and whether the user enables the data processing function, the message transmission is performed; Step S04, MQTT topic forwarding First, the existing MQTT server bottom layer adopts the basic function module to integrate the original function, receives the network connection from the client, processes the message subscription and message publishing request of the client, forwards the message published by the MQTT publisher to the message subscription client, and adds the data processing function; Step S05, when the MQTT Broker receives the data uploaded by the MQTT publisher, according to the data processing configuration document imported by the user, it is determined whether to enable the data processing function; If the data processing function is not enabled, it is the existing MQTT communication protocol, and the corresponding message transmission is performed according to the QoS value in the PUBLISH packet; Step S06, if the data processing function is enabled, the user customizes the data processing rules, including the dirty data filtering rules and the data conversion rules, and processes the data received from the MQTT publisher according to the data processing rules, and calls the MQTT communication protocol to forward the normal data to the message subscription client; Step S07, MQTT cancels the subscription topic, and the subscriber of the MQTT client sends an unsubscribe packet to the server to cancel the subscription topic; Step S08, MQTT disconnects The MQTT client sends a disconnect packet to the server, indicating that the client is normally disconnected.

2. The MQTT communication protocol method for supporting data processing according to claim 1, characterized in that: The MQTT publisher role is deployed in the MQTT client and is a router in the Internet of Things, which connects intelligent edge devices below and collects related data of the intelligent edge devices as original data for reporting MQTT data transmission; The MQTT subscriber role is deployed in the MQTT client and receives the data forwarded from the MQTT Broker by subscribing to the topic topic agreed with the MQTT publisher.

3. The MQTT communication protocol method for supporting data processing according to claim 1, wherein: The feedback packet feedback includes a fixed packet header and a payload, and the packet is displayed as F0 + remaining length + payload; and a feedback flag bit is added to determine whether the publisher receives the feedback packet.

4. The method of claim 1, wherein: In step S03, if the user enables the data processing function, the server determines whether to feed back the information processed by the data to the MQTT publisher through the feedback packet feedback according to whether the feedback flag bit is received in the PUBLISH packet; if the feedback flag bit is received, the feedback information is sent back, otherwise no feedback is performed.

5. The method of claim 1, wherein: In the step S06, firstly, the MQTT Broker processes the data received from the MQTT publisher according to the dirty data filtering rule configured by the user, feeds back the filtered dirty data to the MQTT publisher in the feedback mode, and provides the information feedback function; secondly, for the filtered normal data, data conversion is performed according to the data conversion rule configured by the user; finally, the data converted according to the data conversion rule configured by the user is forwarded to the message subscription client by calling the MQTT communication protocol.

6. The method of claim 1, wherein: The unsubscribe message contains the topic information of the unsubscription.

7. An apparatus, comprising: The computer program is stored in the memory and executed by the processor to realize the method steps of any one of claims 1 to 6.

8. A readable storage medium characterized by: The computer program is stored in the memory and executed by the processor to realize the method steps of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Message routing method based on MQTT and Kafka high-concurrency scene

    CN108768826A