Data publishing method, device, storage medium and apparatus

CN117240948BActive Publication Date: 2026-09-22CHINA MOBILE COMM GRP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210639734.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2026-09-22
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

[0004]本发明的主要目的在于提供一种数据发布方法、设备、存储介质及装置,旨在解决现有技术中MQTT代理服务仅完成主题过滤、数据转发角色,从而导致数据在网络中无节制地传送,消耗不必要的网络及设备资源的技术问题

Benefits of technology

[0035]在本发明中,公开了基于订阅终端发送的订阅消息进行频率协商,获得统一发布频率,将统一发布频率发送至发布终端,并接收发布终端基于统一发布频率下发的发布数据,将发布数据转发至订阅终端;由于本发明通过频率协商生成统一发布频率,以使发布终端基于统一发布频率下发数据,从而能够有效降低数据发布频率,进而能够控制无效数据流量消耗,提高通信效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117240948B_ABST
    Figure CN117240948B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of communication, and discloses a data publishing method, device, storage medium and apparatus, the method comprising the following steps: carrying out frequency negotiation based on a subscription message sent by a subscription terminal, obtaining a unified publishing frequency, sending the unified publishing frequency to a publishing terminal, receiving publishing data issued by the publishing terminal based on the unified publishing frequency, and forwarding the publishing data to the subscription terminal; since the unified publishing frequency is generated through frequency negotiation in the application, the publishing terminal can issue data based on the unified publishing frequency, so that the data publishing frequency can be effectively reduced, invalid data flow consumption can be controlled, and the communication efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a data publishing method, device, storage medium and apparatus. Background Technology

[0002] Message Queuing Telemetry Transport (MQTT) is a lightweight communication protocol based on the publish / subscribe model.

[0003] In existing technical solutions, the MQTT broker service only performs the roles of topic filtering and data forwarding. It forwards published data to one or more subscription terminals that meet the topic conditions without restriction or conditions, resulting in the unrestrained transmission of data in the network and the consumption of unnecessary network and equipment resources. Summary of the Invention

[0004] The main objective of this invention is to provide a data publishing method, device, storage medium, and apparatus, which aims to solve the technical problem that in the prior art, the MQTT broker service only performs the roles of topic filtering and data forwarding, resulting in the unrestrained transmission of data in the network and the consumption of unnecessary network and equipment resources.

[0005] To achieve the above objectives, the present invention provides a data publishing method, which includes the following steps:

[0006] Frequency negotiation is performed based on subscription messages sent by the subscription terminal to obtain a unified publishing frequency;

[0007] The unified release frequency is sent to the release terminal, and the release data sent by the release terminal based on the unified release frequency is received.

[0008] The published data is forwarded to the subscription terminal.

[0009] Optionally, the step of forwarding the published data to the subscribing terminal includes:

[0010] Obtain the delivery conditions from the subscription message;

[0011] When the published data meets the distribution conditions, the published data is forwarded to the subscribing terminal.

[0012] Optionally, the step of forwarding the published data to the subscribing terminal when the published data meets the distribution conditions includes:

[0013] The published data is compared with the published data from the previous time to obtain the comparison results;

[0014] When the comparison result meets the distribution conditions, the published data is forwarded to the subscription terminal.

[0015] Optionally, the step of negotiating the frequency based on the subscription messages sent by the subscription terminal to obtain a unified publishing frequency includes:

[0016] Retrieve the subscription topic from the subscription message sent by the subscription terminal;

[0017] The subscription terminals are grouped based on the subscription topic to obtain subscription terminal groups;

[0018] Frequency negotiation is performed based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group.

[0019] Optionally, the step of negotiating the frequency based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group includes:

[0020] The sampling frequency corresponding to each subscription terminal is obtained from the subscription messages sent by each subscription terminal in the subscription terminal group;

[0021] Frequency negotiation is performed based on the sampling frequency to obtain the unified publishing frequency corresponding to the subscription terminal group.

[0022] Optionally, the step of sending the unified release frequency to the release terminal and receiving the release data issued by the release terminal based on the unified release frequency includes:

[0023] The unified publishing frequency is sent to the publishing terminal corresponding to the subscribed topic, so that the publishing terminal sets a timing trigger based on the unified publishing frequency;

[0024] Receive the publishing data sent by the publishing terminal when it triggers the timing trigger.

[0025] Optionally, before the step of sending the unified release frequency to the release terminal and receiving the release data issued by the release terminal based on the unified release frequency, the method further includes:

[0026] The subscription terminal will respond to the subscription request.

[0027] Accordingly, the step of negotiating the frequency based on the subscription messages sent by the subscription terminal to obtain a unified publishing frequency includes:

[0028] When responding to a subscription request, the unified publishing frequency is sent to the publishing terminal, and the publishing data issued by the publishing terminal based on the unified publishing frequency is received.

[0029] Furthermore, to achieve the above objectives, the present invention also proposes a data publishing device, which includes a memory, a processor, and a data publishing program stored in the memory and executable on the processor, the data publishing program being configured to implement the data publishing method as described above.

[0030] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a data publishing program, which, when executed by a processor, implements the data publishing method as described above.

[0031] In addition, to achieve the above objectives, the present invention also proposes a data publishing device, which includes: a frequency negotiation module, a data receiving module, and a data forwarding module;

[0032] The frequency negotiation module is used to negotiate the frequency based on the subscription message sent by the subscription terminal to obtain a unified publishing frequency;

[0033] The data receiving module is used to send the unified release frequency to the release terminal and receive the release data sent by the release terminal based on the unified release frequency.

[0034] The data forwarding module is used to forward the published data to the subscription terminal.

[0035] This invention discloses a method for frequency negotiation based on subscription messages sent by a subscription terminal to obtain a unified publishing frequency, sending the unified publishing frequency to the publishing terminal, receiving publishing data from the publishing terminal based on the unified publishing frequency, and forwarding the publishing data to the subscription terminal. Because this invention generates a unified publishing frequency through frequency negotiation, enabling the publishing terminal to publish data based on the unified publishing frequency, it can effectively reduce the data publishing frequency, thereby controlling the consumption of invalid data traffic and improving communication efficiency. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of the structure of the data publishing device in the hardware operating environment involved in the embodiments of the present invention;

[0037] Figure 2 This is a flowchart illustrating the first embodiment of the data publishing method of the present invention;

[0038] Figure 3 This is a schematic diagram of the MQTT protocol interaction process in the existing technology;

[0039] Figure 4 This is a flowchart illustrating the second embodiment of the data publishing method of the present invention;

[0040] Figure 5This is a flowchart illustrating the third embodiment of the data publishing method of the present invention;

[0041] Figure 6 This is a schematic diagram of the data publishing interaction process according to an embodiment of the data publishing method of the present invention;

[0042] Figure 7 This is a structural block diagram of the first embodiment of the data publishing device of the present invention;

[0043] Figure 8 This is a schematic diagram of an MQTT broker server according to an embodiment of the data publishing method of the present invention.

[0044] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0045] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0046] Reference Figure 1 , Figure 1 This is a schematic diagram of the data publishing device structure of the hardware operating environment involved in the embodiments of the present invention.

[0047] like Figure 1 As shown, the data publishing device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen, and optionally, it may also include a standard wired interface or a wireless interface. In this invention, the wired interface of the user interface 1003 may be a USB interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or non-volatile memory (NVM), such as a disk storage device. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0048] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the data publishing device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0049] like Figure 1 As shown, the memory 1005, which is identified as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a data publishing program.

[0050] exist Figure 1 In the data publishing device shown, the network interface 1004 is mainly used to connect to the backend server and communicate with the backend server; the user interface 1003 is mainly used to connect to the user equipment; the data publishing device calls the data publishing program stored in the memory 1005 through the processor 1001 and executes the data publishing method provided in the embodiment of the present invention.

[0051] Based on the above hardware structure, an embodiment of the data publishing method of the present invention is proposed.

[0052] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the data publishing method of the present invention, which presents the first embodiment of the data publishing method of the present invention.

[0053] Step S10: Negotiate the frequency based on the subscription messages sent by the subscription terminals to obtain a unified publishing frequency.

[0054] Understandably, Message Queuing Telemetry Transport (MQTT) is a "lightweight" communication protocol based on a publish / subscribe model.

[0055] MQTT is a client-server message publish / subscribe transport protocol. The MQTT protocol is lightweight, simple, open, and easy to implement, and is widely used in the constrained environments of the Internet of Things (IoT) for inter-device communication. Examples include satellite link communication sensors, occasionally dialing medical devices, smart homes, and some miniaturized devices.

[0056] MQTT uses a topic publish / subscribe model, which sends notifications to topics that subscribing terminals are interested in by pushing messages. It also provides topic filters, which are used in subscription expressions to indicate that multiple topics are subscribed to.

[0057] In the Internet of Things (IoT) environment, terminal data resources are acquired by sending requests to the terminal via the network and receiving data responses, with data interaction completed during the request and response process. The MQTT protocol uses a publish-subscribe approach to effectively push resource data, avoiding resource waste caused by duplicate requests. End-to-end data interaction directly impacts network communication efficiency.

[0058] For ease of understanding, please refer to Figure 3This explanation does not limit the scope of this solution. Figure 3 This diagram illustrates the interaction process of the MQTT protocol in existing technologies. In the diagram, the Broker is the MQTT broker server, which receives subscription request messages from Subscribers. The MQTT broker stores subscription requests by Topic and responds with subscription response messages to the subscribers. The MQTT broker waits to receive data messages published by Publishers, filters subscription topics to find the relevant subscribers, and forwards the data messages to the relevant topic subscribers to complete the data interaction process.

[0059] In existing technical solutions, the MQTT broker service only performs the roles of topic filtering and data forwarding. It forwards published data to one or more subscription terminals that meet the topic conditions without restriction or conditions, resulting in the unrestrained transmission of data in the network and the consumption of unnecessary network and equipment resources.

[0060] For example, unnecessary network consumption issues can occur in the following situations:

[0061] 1. To ensure data validity, publishing terminals may use high-frequency data publishing. However, for multiple subscription terminals on the same topic, some of which are not sensitive to the time validity of the resource data published by the publishing terminal, the publishing terminal's unlimited and frequent sending of updated data causes network resource consumption problems.

[0062] 2. In scenarios where multiple subscribers are not sensitive to changes in the range of data values ​​for resource data defined on the same topic, the MQTT broker service unconditionally forwards published data to subscribers, causing network resource consumption issues.

[0063] Therefore, in order to overcome the above-mentioned defects, in this embodiment, a unified publishing frequency is generated through frequency negotiation, so that the publishing terminal can send data based on the unified publishing frequency, thereby effectively reducing the data publishing frequency, controlling the consumption of invalid data traffic, and improving communication efficiency.

[0064] It should be understood that the execution subject of this embodiment may be a data publishing device with data processing, network communication and program running functions, such as a server, or other electronic devices that can achieve the same or similar functions. In this embodiment and other embodiments, the MQTT broker server is used as an example for illustration.

[0065] It should be noted that the subscription message may include information such as the subscription topic, sampling frequency, and delivery conditions.

[0066] It is understandable that obtaining a unified publishing frequency through frequency negotiation based on subscription messages sent by the subscription terminal can be achieved by determining the subscription needs of the corresponding subscription terminal based on the subscription messages sent by the subscription terminal, and then negotiating the frequency based on the subscription needs to obtain a unified publishing frequency.

[0067] Step S20: Send the unified release frequency to the release terminal and receive the release data issued by the release terminal based on the unified release frequency.

[0068] It should be understood that after the unified release frequency is sent to the release terminal, the release terminal can periodically send data based on the unified release frequency.

[0069] Furthermore, to avoid delivery failure, before step S20, the following steps are also included:

[0070] The subscription terminal will respond to the subscription request.

[0071] Accordingly, step S20 includes:

[0072] When responding to a subscription request, the unified publishing frequency is sent to the publishing terminal, and the publishing data issued by the publishing terminal based on the unified publishing frequency is received.

[0073] Understandably, in order to avoid the failure of data delivery, in this embodiment, a subscription response can be sent to the subscribing terminal, and the unified publishing frequency can be sent to the publishing terminal.

[0074] Step S30: Forward the published data to the subscription terminal.

[0075] It should be understood that after receiving the publishing data from the publishing terminal, the MQTT broker server can directly forward the publishing data to the subscribing terminal.

[0076] In the first embodiment, frequency negotiation is performed based on subscription messages sent by the subscription terminal to obtain a unified publishing frequency. The unified publishing frequency is then sent to the publishing terminal, and publishing data is received from the publishing terminal based on the unified publishing frequency. The publishing data is then forwarded to the subscription terminal. Since this embodiment generates a unified publishing frequency through frequency negotiation, enabling the publishing terminal to publish data based on the unified publishing frequency, the data publishing frequency can be effectively reduced, thereby controlling the consumption of invalid data traffic and improving communication efficiency.

[0077] Reference Figure 4 , Figure 4 This is a flowchart illustrating the second embodiment of the data publishing method of the present invention, based on the above. Figure 2 The first embodiment shown presents a second embodiment of the data publishing method of the present invention.

[0078] In the second embodiment, step S10 includes:

[0079] Step S101: Obtain the subscription topic from the subscription message sent by the subscription terminal.

[0080] It should be understood that, in order to distribute data to subscription terminals with the same subscription topic at a unified publishing frequency, in this embodiment, the subscription terminals are first grouped, and then frequency negotiation is performed to obtain a unified publishing frequency corresponding to the subscription terminal group.

[0081] It should be noted that the subscription topic can be any data type that the subscription terminal wants to subscribe to.

[0082] It is understandable that retrieving the subscription topic from the subscription messages sent by the subscription terminal can be done by extracting the subscription topic from the subscription messages sent by the subscription terminal based on the information identifier. The information identifier is used to distinguish between different messages.

[0083] Step S102: Group the subscription terminals based on the subscription topic to obtain subscription terminal groups.

[0084] It should be understood that grouping subscription terminals based on subscription topics to obtain subscription terminal groups can be achieved by grouping subscription terminals with the same subscription topic into the same group.

[0085] Step S103: Based on the subscription messages sent by each subscription terminal in the subscription terminal group, perform frequency negotiation to obtain the unified publishing frequency corresponding to the subscription terminal group.

[0086] It is understandable that frequency negotiation based on the subscription messages sent by each subscription terminal in the subscription terminal group can be used to determine the subscription needs of each subscription terminal based on the subscription messages sent by each subscription terminal in the subscription terminal group, and then negotiate the frequency based on the subscription needs to obtain the unified publishing frequency corresponding to the subscription terminal group.

[0087] In the second embodiment, the following steps are disclosed: obtaining a subscription topic from the subscription message sent by the subscription terminal; grouping the subscription terminals based on the subscription topic to obtain a subscription terminal group; and negotiating the frequency based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain a unified publishing frequency corresponding to the subscription terminal group. Since this embodiment first groups the subscription terminals and then negotiates the frequency, it is possible for subscription terminals with the same subscription topic and a unified publishing frequency to send data.

[0088] In the second embodiment, step S20 includes:

[0089] Step S201: Send the unified publishing frequency to the publishing terminal corresponding to the subscribed topic, so that the publishing terminal sets a timing trigger based on the unified publishing frequency.

[0090] It should be understood that, in order to achieve timed data delivery, in this embodiment, a unified publishing frequency is first sent to the publishing terminal corresponding to the subscribed topic, so that the publishing terminal can set a timing trigger based on the unified publishing frequency.

[0091] It is understandable that setting a timing trigger based on a unified release frequency on the publishing terminal could mean that the publishing terminal first determines the release time interval based on the unified release frequency, and then sets the timing trigger based on the release time interval.

[0092] Step S202: Receive the publishing data sent by the publishing terminal when it triggers the timing trigger.

[0093] It should be understood that when the publishing terminal triggers the timer, it will periodically send data to the MQTT broker server.

[0094] In the second embodiment, a unified publishing frequency is sent to the publishing terminal corresponding to the subscribed topic, so that the publishing terminal sets a timing trigger based on the unified publishing frequency and receives the publishing data sent when the publishing terminal triggers the timing trigger. Since this embodiment sets a timing trigger on the publishing terminal based on the unified publishing frequency and receives the publishing data sent when the publishing terminal triggers the timing trigger, it is possible to send data at regular intervals.

[0095] In the second embodiment, step S30 includes:

[0096] Step S301: Obtain the delivery conditions from the subscription message.

[0097] It should be understood that, in order to meet the actual needs of the subscription terminals, in this embodiment, the published data can also be filtered according to the distribution conditions corresponding to the subscription terminals.

[0098] It should be noted that the distribution conditions can be greater than, less than, or a change threshold condition. Specifically, a greater than condition means that the published data is forwarded to the subscribing terminal when the data value of the published data matching the subscribed topic is greater than a preset first threshold; a less than condition means that the published data is forwarded to the subscribing terminal when the data value of the published data matching the subscribed topic is greater than a preset second threshold; and a change threshold condition means that the published data is forwarded to the subscribing terminal when the difference between the published data matching the subscribed topic and the published data from a previous time period is greater than a preset third threshold.

[0099] Understandably, a subscribing terminal can add delivery conditions to a subscription message before sending it. Therefore, retrieving delivery conditions from a subscription message can be done by parsing the subscription message to obtain the delivery conditions.

[0100] Step S302: When the published data meets the distribution conditions, the published data is forwarded to the subscription terminal.

[0101] It should be understood that when published data meets the distribution conditions, it means that the published data meets the actual needs of the subscribing terminals. Therefore, the published data can be forwarded to the subscribing terminals.

[0102] In the second embodiment, the method of obtaining the delivery conditions from the subscription message is disclosed. When the published data meets the delivery conditions, the published data is forwarded to the subscription terminal. In this embodiment, the published data can also be filtered according to the delivery conditions corresponding to the subscription terminal, so that the subscription terminal can customize the data filtering and thus meet the actual needs of the subscription terminal.

[0103] Reference Figure 5 , Figure 5 This is a flowchart illustrating the third embodiment of the data publishing method of the present invention, based on the above. Figure 4 The second embodiment shown presents a third embodiment of the data publishing method of the present invention.

[0104] In the third embodiment, step S103 includes:

[0105] Step S1031: Obtain the sampling frequency corresponding to each subscription terminal from the subscription messages sent by each subscription terminal in the subscription terminal group.

[0106] It should be understood that, in order to improve the reliability of the unified release frequency, this embodiment also introduces frequency negotiation for the sampling frequency corresponding to each subscription terminal to obtain the unified distribution frequency corresponding to the subscription terminal group.

[0107] It should be noted that the sampling frequency can be the data collection interval set by the subscription terminal according to business needs.

[0108] In practical implementation, the sampling frequency can affect the following aspects: First, the sampling frequency will be used as a parameter to generate the publishing frequency, thereby affecting the frequency at which the publishing terminal initiates data publishing request messages, thus realizing publishing frequency control between the publishing terminal and the MQTT broker server; Second, the sampling frequency will affect the triggering time interval of the sampling timing triggering module. After sampling is triggered, the latest sampled data is read, filtered by parameter conditions, and then the updated data message is published to its subscribing terminals, thereby realizing publishing frequency control between the MQTT broker server and the subscribing terminals.

[0109] Step S1032: Perform frequency negotiation based on the sampling frequency to obtain the unified publishing frequency corresponding to the subscription terminal group.

[0110] It is understandable that frequency negotiation based on sampling frequency can involve comparing sampling frequencies and setting the shortest sampling frequency interval as the unified publishing frequency corresponding to the subscription terminal group.

[0111] In the third embodiment, the sampling frequency corresponding to each subscription terminal is obtained from the subscription messages sent by each subscription terminal in the subscription terminal group, and frequency negotiation is performed based on the sampling frequency to obtain the unified publishing frequency corresponding to the subscription terminal group. Since this embodiment also introduces frequency negotiation based on the sampling frequency corresponding to each subscription terminal, the reliability of the unified publishing frequency can be improved.

[0112] In the third embodiment, step S302 includes:

[0113] Step S3021: Compare the published data with the published data from the previous time to obtain the comparison result.

[0114] It should be understood that, in order to avoid the waste of network resources caused by the repeated publication of the same data, in this embodiment, the published data can also be compared with the published data from the previous time, and when the comparison result meets the distribution conditions, the published data can be forwarded to the subscription terminal.

[0115] It is understandable that comparing the published data with the data published at a previous time can be done by comparing the data value of the published data with the data value of the published data at a previous time, obtaining the data difference between the published data and the data difference, and using the data difference as the comparison result.

[0116] Step S3022: When the comparison result meets the distribution condition, the published data is forwarded to the subscription terminal.

[0117] It should be understood that when the comparison result meets the aforementioned distribution conditions, forwarding the published data to the subscription terminal may be done when the data difference is greater than a preset third threshold.

[0118] For ease of understanding, please refer to Figure 6 This explanation does not limit the scope of this solution. Figure 6 This diagram illustrates the data publishing interaction process. In the diagram, the Broker is the MQTT broker server, the Subscriber is the subscribing terminal, and the Publisher is the publishing terminal. The interaction process includes a subscription message processing flow and a publishing message flow. The subscription message processing flow is as follows:

[0119] 1. The subscribing terminal sends a subscription message to the MQTT broker server. This subscription message contains information such as the subscription topic, sampling frequency, and delivery conditions. The delivery conditions can be greater than a condition, less than a condition, or a change threshold condition, etc.

[0120] 2. After receiving the subscription message, the message receiving module in the MQTT broker server will process it according to the subscription topic in the subscription message, and send the parameters carried in the subscription message and the matching topic to the data storage module for storage.

[0121] 3. The sampling frequency carried in the subscription message is further used by the calculation setting module to generate a unified publishing frequency. The unified publishing frequency is calculated by comparing the sampling frequencies of multiple subscription terminals with the same topic and setting the time interval with the shortest sampling frequency as the unified publishing frequency. The sampling frequency is the data collection interval set by the subscription terminal according to business needs. The sampling frequency can affect the following aspects: First, the sampling frequency will be used as a parameter to generate the publishing frequency, thereby affecting the frequency at which the publishing terminal initiates data publishing request messages, realizing publishing frequency control between the publishing terminal and the MQTT broker server; Second, the sampling frequency will affect the triggering time interval of the sampling timing triggering module. After sampling is triggered, the latest sampling data is read, filtered by parameter conditions, and then the updated data message is published to its subscription terminal, thereby realizing publishing frequency control between the MQTT broker server and the subscription terminal.

[0122] 4. The message sending module then sends a message carrying the topic information or identifier and the publication frequency parameters to the publishing terminal. The publication frequency setting can be carried in the publication data request response message sent by the publishing terminal to the MQTT broker server, or it can be done by defining a new message, which will not affect this proposal.

[0123] 5. Finally, the publishing terminal sets the publishing interval according to the publishing frequency parameter of the topic and periodically sends data publishing requests to the MQTT broker server.

[0124] The message publishing process is as follows:

[0125] 1. The publishing terminal sends a publishing message to the MQTT broker server. This publishing message contains the publishing topic and the resource data information corresponding to the topic.

[0126] 2. After the message receiving module in the MQTT broker server receives the subscribed message, the publishing processing module matches the publishing topic in the published message and further sends it to the data storage module for storage.

[0127] 3. The timing sampling trigger module, based on the sampling frequency provided by the subscribing terminal, reads the published data sent by the publishing terminal to the MQTT broker server from the data storage module after a timed trigger. Then, the publishing filtering module reads the filtering condition information of the subscribing terminal from the data storage module according to the subscribing terminal identifier and performs conditional filtering on the data to be published. The filtering conditions are as follows: A "greater than" condition means that the published data is forwarded to the subscribing terminal when the data value of the published data matching the subscribing topic is greater than a preset first threshold; a "less than" condition means that the published data is forwarded to the subscribing terminal when the data value of the published data matching the subscribing topic is greater than a preset second threshold; a "change threshold" condition means that the published data is forwarded to the subscribing terminal when the difference between the published data matching the subscribing topic and the published data from the previous time period is greater than a preset third threshold.

[0128] 4. When the data value to be published meets the filtering conditions, the publishing filtering module sends the data to its subscribing terminals through the message sending module.

[0129] In the third embodiment, the method of comparing the published data with the published data of the previous time to obtain the comparison result is disclosed. When the comparison result meets the delivery conditions, the published data is forwarded to the subscription terminal. Since this embodiment compares the published data with the published data of the previous time and forwards the published data to the subscription terminal when the comparison result meets the delivery conditions, it can avoid the waste of network resources caused by publishing the same data multiple times and reduce network traffic consumption.

[0130] Furthermore, this embodiment of the invention also proposes a storage medium storing a data publishing program, which, when executed by a processor, implements the data publishing method as described above.

[0131] In addition, refer to Figure 7 The present invention also proposes a data publishing device, which includes: a frequency negotiation module 10, a data receiving module 20, and a data forwarding module 30;

[0132] The frequency negotiation module 10 is used to negotiate the frequency based on the subscription message sent by the subscription terminal to obtain a unified publishing frequency.

[0133] Understandably, Message Queuing Telemetry Transport (MQTT) is a "lightweight" communication protocol based on a publish / subscribe model.

[0134] MQTT is a client-server message publish / subscribe transport protocol. The MQTT protocol is lightweight, simple, open, and easy to implement, and is widely used in the constrained environments of the Internet of Things (IoT) for inter-device communication. Examples include satellite link communication sensors, occasionally dialing medical devices, smart homes, and some miniaturized devices.

[0135] MQTT uses a topic publish / subscribe model, which sends notifications to topics that subscribing terminals are interested in by pushing messages. It also provides topic filters, which are used in subscription expressions to indicate that multiple topics are subscribed to.

[0136] In the Internet of Things (IoT) environment, terminal data resources are acquired by sending requests to the terminal via the network and receiving data responses, with data interaction completed during the request and response process. The MQTT protocol uses a publish-subscribe approach to effectively push resource data, avoiding resource waste caused by duplicate requests. End-to-end data interaction directly impacts network communication efficiency.

[0137] For ease of understanding, please refer to Figure 3 This explanation does not limit the scope of this solution. Figure 3 This diagram illustrates the interaction process of the MQTT protocol in existing technologies. In the diagram, the Broker is the MQTT broker server, which receives subscription request messages from Subscribers. The MQTT broker stores subscription requests by Topic and responds with subscription response messages to the subscribers. The MQTT broker waits to receive data messages published by Publishers, filters subscription topics to find the relevant subscribers, and forwards the data messages to the relevant topic subscribers to complete the data interaction process.

[0138] In existing technical solutions, the MQTT broker service only performs the roles of topic filtering and data forwarding. It forwards published data to one or more subscription terminals that meet the topic conditions without restriction or conditions, resulting in the unrestrained transmission of data in the network and the consumption of unnecessary network and equipment resources.

[0139] For example, unnecessary network consumption issues can occur in the following situations:

[0140] 1. To ensure data validity, publishing terminals may use high-frequency data publishing. However, for multiple subscription terminals on the same topic, some of which are not sensitive to the time validity of the resource data published by the publishing terminal, the publishing terminal's unlimited and frequent sending of updated data causes network resource consumption problems.

[0141] 2. In scenarios where multiple subscribers are not sensitive to changes in the range of data values ​​for resource data defined on the same topic, the MQTT broker service unconditionally forwards published data to subscribers, causing network resource consumption issues.

[0142] Therefore, in order to overcome the above-mentioned defects, in this embodiment, a unified publishing frequency is generated through frequency negotiation, so that the publishing terminal can send data based on the unified publishing frequency, thereby effectively reducing the data publishing frequency, controlling the consumption of invalid data traffic, and improving communication efficiency.

[0143] It should be noted that the subscription message may include information such as the subscription topic, sampling frequency, and delivery conditions.

[0144] It is understandable that obtaining a unified publishing frequency through frequency negotiation based on subscription messages sent by the subscription terminal can be achieved by determining the subscription needs of the corresponding subscription terminal based on the subscription messages sent by the subscription terminal, and then negotiating the frequency based on the subscription needs to obtain a unified publishing frequency.

[0145] The data receiving module 20 is used to send the unified release frequency to the release terminal and receive the release data issued by the release terminal based on the unified release frequency.

[0146] It should be understood that after the unified release frequency is sent to the release terminal, the release terminal can periodically send data based on the unified release frequency.

[0147] The data forwarding module 30 is used to forward the published data to the subscription terminal.

[0148] It should be understood that after receiving the publishing data from the publishing terminal, the MQTT broker server can directly forward the publishing data to the subscribing terminal.

[0149] For ease of understanding, please refer to Figure 8 This explanation does not limit the scope of this solution. Figure 8 This is a schematic diagram of an MQTT broker server. In the diagram, the MQTT broker server includes a message sending module, a message receiving module, a subscription processing module, a publishing processing module, a publishing frequency calculation and setting module, a data storage module, a timing sampling triggering module, and a publishing filtering module.

[0150] Among them, the message sending / receiving module:

[0151] This implements data communication functions between the MQTT broker server and subscribers, and between the MQTT broker server and publishers. Subscribers send subscription messages to the MQTT broker server; the MQTT broker server sends publication frequency setting messages to the publishers; the publishers send topic publication messages to the MQTT broker server; and the MQTT broker server sends topic publication messages to subscribers.

[0152] Subscription processing module:

[0153] After receiving a subscription request message from a subscriber, the subscription processing module searches and matches the topic field information in the message content, and then stores parameters such as sampling frequency and filtering conditions according to the matched topic. Furthermore, a timer trigger is set based on the subscriber's subscription topic name and sampling frequency to periodically push the latest data that meets the filtering conditions to the subscriber.

[0154] Release processing module:

[0155] After receiving the publishing request message pushed by the publishing terminal, the publishing processing module searches and matches the topic field information in the message content, and then stores the latest updated resource data according to the matched topic.

[0156] Release frequency calculation setting module:

[0157] The publishing frequency calculation and setting module reads all the sampling frequencies of all subscribers matching the specified topic when a subscriber sets or updates the resource data sampling frequency parameter corresponding to the specified subscription topic, further recalculates and sets a unified publishing frequency, and then sends the publishing frequency to the publishing terminal through the message sending module.

[0158] Data storage module:

[0159] The data storage module stores sampling frequency information, filtering condition information, and published data information.

[0160] Timing sampling trigger module:

[0161] The timing sampling trigger module sets the timing trigger device according to the sampling frequency of the topic specified by the subscriber, thereby realizing the timing to initiate data filtering and push resource data to the subscriber.

[0162] Publish filtering module:

[0163] The publishing filtering module function is to read the filtering condition parameter information set by the topic in the data storage after the timing sampling trigger module is triggered, and then realize the publishing condition filtering function of the latest data. For messages that meet the filtering conditions, the data message is pushed to its subscribers through the message sending module.

[0164] In this embodiment, frequency negotiation is performed based on subscription messages sent by the subscription terminal to obtain a unified publishing frequency. The unified publishing frequency is then sent to the publishing terminal, and publishing data distributed by the publishing terminal based on the unified publishing frequency is received. The publishing data is then forwarded to the subscription terminal. Since this embodiment generates a unified publishing frequency through frequency negotiation, enabling the publishing terminal to distribute data based on the unified publishing frequency, the data publishing frequency can be effectively reduced, thereby controlling the consumption of invalid data traffic and improving communication efficiency.

[0165] Other embodiments or specific implementations of the work order dispatch device of the present invention can be referred to the above-described method embodiments, and will not be repeated here.

[0166] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0167] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0168] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as a read-only memory image (ROM) / random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0169] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A data publishing method, characterized in that, The data publishing method includes the following steps: Frequency negotiation is performed based on subscription messages sent by the subscription terminal to obtain a unified publishing frequency; The unified release frequency is sent to the release terminal, and the release data sent by the release terminal based on the unified release frequency is received. The published data is forwarded to the subscribing terminal; The step of negotiating a unified publishing frequency based on subscription messages sent by the subscription terminal includes: Retrieve the subscription topic from the subscription message sent by the subscription terminal; The subscription terminals are grouped based on the subscription topic to obtain subscription terminal groups; Frequency negotiation is performed based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group; The step of negotiating the frequency based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group includes: The sampling frequency corresponding to each subscription terminal is obtained from the subscription messages sent by each subscription terminal in the subscription terminal group; Frequency negotiation is performed based on the sampling frequency to obtain the unified publishing frequency corresponding to the subscription terminal group.

2. The data publishing method as described in claim 1, characterized in that, The step of forwarding the published data to the subscribing terminal includes: Obtain the delivery conditions from the subscription message; When the published data meets the distribution conditions, the published data is forwarded to the subscribing terminal.

3. The data publishing method as described in claim 2, characterized in that, The step of forwarding the published data to the subscribing terminal when the published data meets the distribution conditions includes: The published data is compared with the published data from the previous time to obtain the comparison results; When the comparison result meets the distribution conditions, the published data is forwarded to the subscription terminal.

4. The data publishing method as described in claim 1, characterized in that, The step of sending the unified release frequency to the release terminal and receiving the release data issued by the release terminal based on the unified release frequency includes: The unified publishing frequency is sent to the publishing terminal corresponding to the subscribed topic, so that the publishing terminal sets a timing trigger based on the unified publishing frequency; Receive the publishing data sent by the publishing terminal when it triggers the timing trigger.

5. The data publishing method as described in any one of claims 1 to 4, characterized in that, Before the step of sending the unified release frequency to the release terminal and receiving the release data issued by the release terminal based on the unified release frequency, the method further includes: The subscription terminal will respond to the subscription request. Accordingly, the step of negotiating the frequency based on the subscription messages sent by the subscription terminal to obtain a unified publishing frequency includes: When responding to a subscription request, the unified publishing frequency is sent to the publishing terminal, and the publishing data issued by the publishing terminal based on the unified publishing frequency is received.

6. A data publishing device, characterized in that, The data publishing device includes: a memory, a processor, and a data publishing program stored in the memory and executable on the processor, wherein the data publishing program, when executed by the processor, implements the data publishing method as described in any one of claims 1 to 5.

7. A storage medium, characterized in that, The storage medium stores a data publishing program, which, when executed by a processor, implements the data publishing method as described in any one of claims 1 to 5.

8. A data publishing device, characterized in that, The data publishing device includes: a frequency negotiation module, a data receiving module, and a data forwarding module; The frequency negotiation module is used to negotiate the frequency based on the subscription message sent by the subscription terminal to obtain a unified publishing frequency; The data receiving module is used to send the unified release frequency to the release terminal and receive the release data sent by the release terminal based on the unified release frequency. The data forwarding module is used to forward the published data to the subscription terminal; The step of negotiating a unified publishing frequency based on subscription messages sent by the subscription terminal includes: Retrieve the subscription topic from the subscription message sent by the subscription terminal; The subscription terminals are grouped based on the subscription topic to obtain subscription terminal groups; Frequency negotiation is performed based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group; The step of negotiating the frequency based on the subscription messages sent by each subscription terminal in the subscription terminal group to obtain the unified publishing frequency corresponding to the subscription terminal group includes: The sampling frequency corresponding to each subscription terminal is obtained from the subscription messages sent by each subscription terminal in the subscription terminal group; Frequency negotiation is performed based on the sampling frequency to obtain the unified publishing frequency corresponding to the subscription terminal group.

Citation Information

Patent Citations

  • Method and apparatus for negotiating "keep-alive" message frequencies of applications running on a mobile station

    CN104813641A