Configuration method, system and device of personalized MQTT protocol and medium

Through the personalized MQTT protocol configuration method, the preset template and automatic configuration mechanism are used to solve the flexibility and personalization of MQTT protocol configuration in the existing technology, and efficient and reliable MQTT connection services are realized to adapt to different devices and scenarios. need.

CN119031049APending Publication Date: 2024-11-26SHANGHAI FLEXEM TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410975400.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The existing MQTT protocol configuration methods lack flexibility and personalized customization capabilities, and cannot meet the needs of different devices and scenarios. Especially in large-scale device deployment and management, there are problems such as cumbersome configuration and error-prone.

Method used

Provide a personalized MQTT protocol configuration method, which automatically extracts and configures connection information, topic information and content information parameters through user input requirements, and dynamically adjusts the publishing frequency and subscription topic number according to service quality level and network status. Realize intelligent optimization of MQTT connection service.

Benefits of technology

It greatly reduces the workload of manual configuration for users, improves configuration efficiency and accuracy, ensures the stability and reliability of MQTT connection services, adapts to the needs of different application scenarios, and reduces configuration complexity and difficulty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031049A_ABST
    Figure CN119031049A_ABST
Patent Text Reader

Abstract

The invention discloses a personalized MQTT protocol configuration method, system and device and a medium, and relates to the field of Internet of Things communication. The method comprises the following steps: in response to an operation of inputting a demand by a user, judging whether a target template can be matched from preset templates according to the demand; when a target template can be matched from the preset templates according to requirements, in response to an operation of inputting basic information by a user, extracting target information from the basic information, and configuring a first parameter of the target template according to a preset rule of the target template and the target information; determining a service quality level according to a demand, determining a publishing frequency and a subscription theme number according to a current network state, and configuring a second parameter of the target template according to the service quality level, the publishing frequency and the subscription theme number; and creating an MQTT connection service according to the configured target template to realize communication and data exchange between the target devices. By implementing the technical scheme provided by the invention, the flexibility and accuracy of configuration are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet of Things communications, and in particular to a configuration method, system, electronic device and storage medium for a personalized MQTT protocol. Background Art

[0002] With the continuous development of IoT technology, MQTT (Message Queuing Telemetry Transport) protocol, as a lightweight publish / subscribe message transmission protocol, has been widely used in IoT device communication. However, in actual applications, due to the differences in different devices and application scenarios, the configuration requirements for MQTT protocol are also different.

[0003] Existing MQTT protocol configuration methods usually use fixed templates or manual configuration. Although these methods can achieve basic configuration functions, they lack flexibility and personalized customization capabilities. The fixed template configuration method cannot be flexibly adjusted according to actual needs, while the manual configuration method is cumbersome and prone to errors, and cannot meet the needs of large-scale device deployment and management.

[0004] Therefore, how to provide a method that can flexibly configure the MQTT protocol to meet the needs of different devices and scenarios has become an urgent problem to be solved in the current technical field. Summary of the invention

[0005] The present application provides a configuration method, system, device and medium for a personalized MQTT protocol, which can flexibly configure the MQTT protocol to meet the needs of different devices and scenarios.

[0006] In a first aspect of the present application, a method for configuring a personalized MQTT protocol is provided, characterized in that it is applied to a protocol configuration platform, and the method comprises: In response to a user input operation of a requirement, determining whether a target template can be matched from a preset template according to the requirement; When a target template can be matched from a preset template according to the requirement, in response to an operation of a user inputting basic information, target information is extracted from the basic information, and a first parameter of the target template is configured according to a preset rule of the target template and the target information, wherein the first parameter includes a connection information parameter, a subject information parameter, and a content information parameter; Determine a quality of service level according to the demand, determine a publishing frequency and a number of subscription topics according to a current network state, and configure a second parameter of the target template according to the quality of service level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; Create an MQTT connection service based on the configured target template to achieve communication and data exchange between target devices.

[0007] By adopting the above technical solution, when the user inputs the demand, the protocol configuration platform can quickly determine whether there is a matching target template, thereby greatly reducing the workload of manual configuration by the user. After matching the target template, the user only needs to enter the basic information, and the protocol configuration platform can automatically extract the target information and configure it according to the preset rules of the template. The configuration method covers the configuration of the first parameters such as connection information parameters, topic information parameters and content information parameters, ensuring the basic functions of the MQTT connection service. The configuration of the second parameter, including the publishing and subscription logic and the publishing and subscription strategy, can be dynamically adjusted according to the specific needs of the user, the service quality level, the current network status, the publishing frequency and the number of subscription topics, so that the MQTT connection service is more in line with the actual application scenario. The MQTT connection service created by the configured target template can realize communication and data exchange between target devices to meet the personalized needs of users. Since factors such as network status and service quality level are considered in the configuration process, the created MQTT connection service has better stability and reliability. Users only need to enter the requirements and basic information through simple operations to complete the configuration of the MQTT protocol without in-depth understanding of the protocol details and underlying implementation. The configuration process of templates and parameters is recorded and managed by the protocol configuration platform, which facilitates subsequent viewing and modification and improves the maintainability of the protocol configuration platform.

[0008] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The connection information parameters of the target template are configured according to the first sub-preset rule of the target template and the connection information in the target information. The connection information parameters include a connection field and attributes corresponding to the connection field. The connection field includes the host address, port number, user name, password, and authentication encryption method required to connect to the MQTT server. The attributes include data types, association relationships, and verification rules.

[0009] By adopting the above technical solution, the key information required for connecting to the MQTT server, such as the host address, port number, user name, password, etc., is included in the connection information parameters to ensure that the MQTT client can accurately connect to the server. At the same time, it also includes authentication encryption methods to improve the security of the connection. For each element of the connection field, its data type is clearly defined, such as the host address may be a string type, the port number may be an integer type, etc., which helps to ensure that the information format entered by the user is correct and avoids configuration errors caused by data type mismatch. The setting of the association relationship makes the various fields in the connection information no longer isolated, but interrelated and mutually influential. For example, the host address and port number jointly determine the target location of the connection, and the user name and password are used for identity authentication. This clarification of the association relationship helps users better understand the configuration process and improve the accuracy of the configuration. By setting verification rules, the protocol configuration platform can automatically verify the information entered by the user to ensure the legitimacy and validity of the information. For example, the port number must be within a certain range, and the user name and password must conform to a specific format. This verification mechanism can promptly detect and correct errors in user input, avoiding connection failures or other problems caused by information errors. Due to the use of preset rules and automatic verification mechanisms, users do not need to manually enter a large amount of configuration information, nor do they need to worry about input errors, which greatly improves the efficiency and accuracy of the configuration. At the same time, since the configuration process is standardized and modularized, the complexity and difficulty of the configuration are also reduced. Since the connection information parameters are clearly and structured and stored in the protocol configuration platform, it is convenient for subsequent viewing and modification. At the same time, when it is necessary to add new connection fields or modify existing fields, it is only necessary to modify the preset rules, without making large-scale changes to the entire protocol configuration platform, thereby enhancing the maintainability and scalability of the protocol configuration platform.

[0010] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The subject information parameters of the target template are configured according to the second sub-preset rule of the target template and the subject information in the target information, wherein the second sub-preset rule includes a static rule and a dynamic rule, wherein the static rule is a preset fixed subject, and the dynamic rule is a variable subject set using a placeholder.

[0011] By adopting the above technical solution, static rules and dynamic rules are introduced to make the configuration of topic information more flexible. Static rules are applicable to those fixed topics, while dynamic rules allow the use of placeholders to set variable topics, so that the topic information can be dynamically adjusted according to actual needs. This configuration method can better meet the different needs of users, especially in application scenarios such as the Internet of Things and smart homes, where the topic information of the device may change with the changes of factors such as the status and location of the device. Static rules allow fixed topics to be preset, which reduces the operation of users manually entering topic information and improves configuration efficiency. Dynamic rules use placeholders to allow users to set variable topics through simple replacement operations, further simplifying the configuration process. The use of dynamic rules enables the protocol configuration platform to support more topic information configuration methods. When it is necessary to add new topics or modify existing topics, it is only necessary to modify the corresponding dynamic rules without making large-scale changes to the entire protocol configuration platform. This scalability enables the protocol configuration platform to better adapt to changing application scenarios and user needs. By presetting fixed topics and using placeholders to set variable topics, the accuracy and consistency of topic information can be ensured, avoiding protocol configuration platform problems caused by manual input errors by users. At the same time, the use of dynamic rules can also dynamically adjust the topic information according to factors such as network status and device status, improving the reliability and stability of the protocol configuration platform. In some complex application scenarios, such as the smart home protocol configuration platform, different devices may need to subscribe to different topics to receive corresponding messages. Through the combined use of static rules and dynamic rules, such complex application scenarios can be easily implemented, allowing the protocol configuration platform to better meet user needs.

[0012] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The content information parameters of the target template are configured according to the third sub-preset rule of the target template and the content information in the target information, wherein the third sub-preset rule includes defining the data structure, data type, field name, data format and time format of the message payload.

[0013] By adopting the above technical solution, the data structure of the message payload can be clearly defined based on the third sub-preset rule, including the hierarchy of data, the relationship between fields, etc. This helps to ensure the integrity and consistency of the data and avoid errors and ambiguities in the data parsing process. The data types (such as integers, floating point numbers, strings, binary data, etc.) and data formats (such as UTF-8 encoding, hexadecimal representation, etc.) are clearly specified in the rules, so that the data has clear specifications and standards during transmission and parsing. This helps to ensure the accuracy and reliability of the data and avoid errors caused by inconsistent data types or formats. The field names are defined in the rules so that different devices or protocol configuration platforms can use unified field names when transmitting data. This helps to simplify the data parsing and processing process and improve the compatibility and scalability of the protocol configuration platform. In some application scenarios, timestamps are an important part of the message payload. By unifying the time format through the third sub-preset rule, it can ensure consistency and accuracy when parsing timestamps between different devices or protocol configuration platforms. Since the data structure, data type, field name and data format are clearly defined and standardized, the protocol configuration platform can parse and extract data more quickly and accurately when processing MQTT messages. This helps improve the responsiveness and overall performance of the protocol configuration platform.

[0014] Optionally, determining the service quality level according to the demand and determining the publishing frequency and the number of subscription topics according to the current network status includes: Determine the service quality level based on real-time requirements and the importance of data; Determine whether the current network delay is greater than a threshold, and when the current network delay is greater than the threshold, reduce the publishing frequency and reduce the number of subscribed topics; and when the network delay is less than or equal to the threshold, increase the publishing frequency and expand the number of subscribed topics.

[0015] By adopting the above technical solution, the service quality level is determined by real-time requirements and data importance, which can ensure that key data and application scenarios that require rapid response are given priority, while avoiding unnecessary waste of resources. Dynamically adjusting the publishing frequency and the number of subscription topics according to the network status can reduce the amount of data transmission when the network condition is poor, reduce network congestion, and improve the overall utilization of network resources. When the network delay exceeds the threshold, reducing the publishing frequency and reducing the number of subscription topics can reduce errors and losses in the data transmission process and improve the reliability and stability of data transmission. This method can also avoid device overload or crash caused by network problems, thereby improving the reliability of the entire system. For application scenarios that require real-time response, such as smart homes and industrial automation, by optimizing the service quality level and publishing frequency, it can ensure that the communication between devices is faster and more accurate, thereby improving the user experience. When the network condition is good, increasing the publishing frequency and expanding the number of subscription topics can provide users with richer information and functions. The configuration parameters of the MQTT protocol can be automatically adjusted according to the network status to achieve intelligent adaptation to the network environment. This intelligent adaptability enables the system to maintain the best working state in different network environments.

[0016] Optionally, configuring the second parameter of the target template according to the service quality level, publishing frequency, and number of subscription topics includes: Set different priorities for messages according to the importance and urgency of the business, sort messages according to priority in the message queue, and dynamically adjust the priority of messages according to system status and business needs; The target device to receive the message is determined based on business requirements and basic information of the device, where the basic information includes the geographical location, type, and function of the device.

[0017] By adopting the above technical solution, the priority sorting of messages ensures that high-priority, important or urgent messages can be processed first, thereby improving the efficiency and accuracy of resource scheduling. The protocol configuration platform can reasonably allocate resources according to the importance and urgency of the business, avoiding resource waste or delayed processing of key information. By giving priority to high-priority messages, the protocol configuration platform can respond to business needs more quickly, reduce business processing time, and improve user experience and satisfaction. Especially in emergency situations, high-priority messages can be processed quickly to avoid potential risks or losses. The target device for receiving the message is determined based on the basic information of the device (such as geographic location, type and function), so that the message can be accurately pushed to the target device to avoid invalid transmission and waste. The priority of the message can be dynamically adjusted according to the status of the protocol configuration platform and business needs. This flexibility enables the protocol configuration platform to adapt to changes in needs in different scenarios. At the same time, dynamically determining the target device based on the basic information of the device also makes the protocol configuration platform more adaptable and scalable. By prioritizing messages and intelligently targeting, the protocol configuration platform can better control message traffic and processing pressure, avoiding the crash or performance degradation of the protocol configuration platform due to overload. This helps to improve the stability and reliability of the protocol configuration platform and ensure that the protocol configuration platform can operate stably in various complex environments.

[0018] Optionally, configuring the second parameter of the target template according to the service quality level, publishing frequency, and number of subscription topics includes: The parameters of the target template error detection mechanism and the retry mechanism are configured according to the service quality level, publishing frequency and number of subscription topics. The error detection mechanism includes determining errors through heartbeat detection and timeout judgment, and performing repair processing according to the error type and severity. The retry mechanism includes resending the message according to the configured number of retries and retry interval when the message fails to be sent.

[0019] By adopting the above technical solution and configuring the error detection mechanism, the protocol configuration platform can use heartbeat detection and timeout judgment to monitor the possible errors in the MQTT communication process in real time. Once an error is found, the protocol configuration platform can immediately take corresponding repair measures to ensure the reliable transmission of the message. The error detection mechanism can perform repair processing according to the error type and severity, which enables the protocol configuration platform to adopt more accurate and effective solution strategies for different types of errors, thereby improving the reliability of message transmission. According to the service quality level, publishing frequency and number of subscription topics, the parameters of the retry mechanism are configured, and the protocol configuration platform can resend the message according to the configured number of retries and retry interval when the message fails to be sent. This retry mechanism can ensure that the message can still be successfully sent and received when network fluctuations or other communication failures occur. By reasonably configuring the number of retries and retry interval, the protocol configuration platform can ensure the timeliness of the message while minimizing the additional burden on the network bandwidth and protocol configuration platform resources caused by frequent retries. By reasonably configuring the parameters of the error detection mechanism and the retry mechanism, the protocol configuration platform can ensure the reliable transmission of the message while also taking into account the performance and resource utilization of the protocol configuration platform. For example, when configuring the retry mechanism, the protocol configuration platform can set the appropriate number of retries and retry intervals according to the actual situation to avoid performance degradation or resource exhaustion of the protocol configuration platform due to frequent retries. By parameterizing the error detection mechanism and retry mechanism of the target template, the protocol configuration platform can be maintained and expanded more conveniently. When the protocol configuration platform needs to adapt to new business scenarios or network environments, it only needs to adjust the corresponding configuration parameters without making a lot of modifications to the protocol configuration platform code. This greatly improves the maintainability and scalability of the protocol configuration platform.

[0020] In a second aspect of the present application, a personalized MQTT protocol configuration system is provided, characterized in that it includes a judgment module, a first configuration module, a second configuration module and an execution module, wherein: A judgment module, configured to respond to the operation of the user input requirement and judge whether a target template can be matched from the preset templates according to the requirement; A first configuration module is configured to extract target information from the basic information in response to an operation of a user inputting basic information when a target template can be matched from a preset template according to the requirement, and configure first parameters of the target template according to a preset rule of the target template and the target information, wherein the first parameters include a connection information parameter, a theme information parameter, and a content information parameter; a second configuration module configured to determine a service quality level according to the demand, determine a publishing frequency and a number of subscription topics according to a current network state, and configure a second parameter of the target template according to the service quality level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; The execution module is configured to create an MQTT connection service according to the configured target template to achieve communication and data exchange between target devices.

[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.

[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.

[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Through the matching mechanism of preset templates, it can quickly respond to user needs and find suitable target templates, thereby greatly reducing the time and complexity of manually configuring the MQTT protocol. This method allows users to configure the MQTT service through simple input operations, improving the deployment efficiency of the entire system; 2. Extract target information based on the basic information input by the user, and configure the first parameter according to the preset rules of the target template, ensuring the personalized configuration of the MQTT connection. The first parameter includes connection information parameters, topic information parameters and content information parameters. The personalized configuration of these parameters can meet the needs of different devices and business scenarios; 3. Determine the service quality level, publishing frequency and number of subscription topics according to user needs and current network status, and configure the second parameter accordingly, realizing intelligent optimization of MQTT communication. This method can ensure that the amount of data transmission is reduced when the network condition is poor, reduce network congestion and improve resource utilization. At the same time, the priority of messages is dynamically adjusted according to the system status and business needs, further improving the system's response speed and resource utilization; 4. Through the configuration of error detection mechanism and retry mechanism, it is possible to monitor the possible errors in the MQTT communication process in real time, and take repair measures to ensure the reliable transmission of messages; when the message fails to be sent, it will be resent according to the configured number of retries and retry interval, further enhancing the stability and reliability of the system; 5. The personalized MQTT protocol configuration method enables users to quickly and conveniently configure the MQTT service according to their own needs, improving the user experience; the efficient MQTT connection service can achieve fast communication and data exchange between target devices, meeting the user's needs for real-time and reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a flowchart of a configuration method of a personalized MQTT protocol disclosed in an embodiment of the present application; Figure 2 It is a flowchart of defining connection fields in the MQTT preset template disclosed in the embodiment of the present application; Figure 3 It is a flowchart of the MQTT preset template defining topic types and rules disclosed in the embodiment of the present application; Figure 4 It is a schematic diagram of the main information of the message format defined by the MQTT preset template disclosed in the embodiment of the present application; Figure 5 It is a flow chart of applying the MQTT preset template disclosed in the embodiment of the present application; Figure 6 It is a module schematic diagram of a configuration system for a personalized MQTT protocol disclosed in an embodiment of the present application; Figure 7 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0025] Explanation of the reference numerals: 601, judgment module; 602, first configuration module; 603, second configuration module; 604, execution module; 701, processor; 702, communication bus; 703, user interface; 704, network interface; 705, memory. DETAILED DESCRIPTION

[0026] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0027] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0028] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0029] This embodiment discloses a configuration method of a personalized MQTT protocol. Figure 1 It is a flow chart of the configuration method of the personalized MQTT protocol disclosed in the embodiment of the present application, such as Figure 1 As shown, the configuration method includes the following steps: S110, in response to the user inputting a requirement, determining whether a target template can be matched from a preset template according to the requirement; Users enter their MQTT configuration requirements on the user interface of the protocol configuration platform. These requirements may include, but are not limited to: connection type (e.g., whether SSL / TLS encrypted connection is required), communication protocol version (multiple versions of the MQTT protocol have different functions and features, and users may need to specify the version they want), quality of service (QoS) level (different application scenarios may require different QoS levels to ensure reliable transmission of messages), publishing and subscription topics (users may need to specify the topics they want to publish or subscribe to), device type and number (configuration may need to adapt to different types and numbers of devices), data format (e.g., JSON, XML, or other formats). In the backend of the protocol configuration platform, there is a preset MQTT configuration template library. These templates are pre-defined MQTT configuration templates for different application scenarios and requirements. Each template contains a set of preset parameters and rules for quickly generating MQTT configurations that meet specific requirements. After users enter their requirements, the protocol configuration platform will start looking for matching templates from the preset template library. The matching process usually involves the following steps: the protocol configuration platform parses the requirements input by the user and extracts the key requirement information; based on the extracted requirement information, the protocol configuration platform will filter out qualified templates in the template library. The screening conditions may include but are not limited to: connection type, protocol version, QoS level, topic type, etc.; if there are multiple templates screened out, the protocol configuration platform will select the best matching template according to certain strategies (such as scoring algorithm, priority sorting, etc.). If the system can successfully match the target template, it will feedback the result to the user and allow the user to further configure or fine-tune the parameters of the template. If no template can be matched, the protocol configuration platform may prompt the user to enter more detailed or specific requirements, or suggest that the user manually create a new MQTT configuration.

[0030] S120, when a target template can be matched from a preset template according to the requirement, in response to an operation of a user inputting basic information, extracting target information from the basic information, and configuring a first parameter of the target template according to a preset rule of the target template and the target information, the first parameter including a connection information parameter, a theme information parameter, and a content information parameter; After successfully matching the target template, the protocol configuration platform will guide the user to enter basic information related to the MQTT connection service. This information is necessary to configure the MQTT service, usually including but not limited to connection information, topic information and content information. Connection information: including server address (IP address or domain name), port number, connection authentication information (such as user name and password). Topic information: including the topic names of publish and subscribe, which are used to define the path of message delivery. Content information: describes the format and rules of the message content, such as whether the message needs to be encrypted, the encoding method of the message (such as UTF-8, ASCII, etc.), and the serialization method of the message (such as JSON, XML, etc.). After the user enters the basic information, the protocol configuration platform will extract the target information from this information. The target information will be used to configure the first parameter of the target template to ensure that the MQTT service can correctly connect and exchange data according to the user's needs. The protocol configuration platform will extract the server address, port number, connection authentication information, etc. from the user input to configure the connection parameters of the MQTT client. The protocol configuration platform will extract the publish and subscribe topics specified by the user, which will be used to construct the topic field of the MQTT message. The protocol configuration platform will configure the content format and encoding method of the MQTT message according to the message content format and rules entered by the user. After extracting the target information, the protocol configuration platform will configure the first parameter according to the preset rules of the target template. These preset rules are defined when creating the template and are used to configure the parameters of the MQTT service according to the information entered by the user.

[0031] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The connection information parameters of the target template are configured according to the first sub-preset rule of the target template and the connection information in the target information. The connection information parameters include a connection field and attributes corresponding to the connection field. The connection field includes the host address, port number, user name, password, and authentication encryption method required to connect to the MQTT server. The attributes include data types, association relationships, and verification rules.

[0032] The protocol configuration platform extracts key information related to connecting to the MQTT server from the basic information entered by the user, which usually includes the host address (IP address or domain name), port number, user name, password, and possible authentication and encryption methods. The protocol configuration platform identifies the first sub-preset rule for configuring the connection information parameters in the target template. The first sub-preset rule is predefined when creating the template and is used to configure the connection information parameters based on the information entered by the user.

[0033] Figure 2is a flow chart of defining connection fields in the MQTT preset template disclosed in the embodiment of the present application, such as Figure 2 As shown in the figure, the connection fields defined in the MQTT preset template include S210, creating connection fields; S220, selecting the format type; S230, setting association rules; S240, setting default values; S250, setting field length limits. Determine the connection fields such as the host address, port number, user name, password, authentication encryption method, etc. required to connect to the MQTT Broker (server side). For each field, define its data type, association relationship, verification rules and other attributes. The attributes agreed on the fields in the target template determine the information format filled in by the user when using the template to create a service. For example, the host address uses a string type, the port number uses an integer type, and the association relationship between the host address and the port number and the necessary verification rules are set, such as length, format, whether it is required, whether it is read-only, etc.

[0034] The protocol configuration platform specifies the appropriate data type (such as string, integer, Boolean, etc.) for each connection field based on the actual purpose of the field and the requirements of the MQTT protocol. In some cases, there may be associations between connection fields, such as the association between port numbers and specific protocol versions. The protocol configuration platform ensures that these associations are handled correctly during the configuration process. In order to ensure that the information entered by the user complies with the requirements of the MQTT protocol and the configuration on the server side, the protocol configuration platform configures validation rules for each connection field. These rules may include length restrictions, format requirements, character set restrictions, etc. When the information entered by the user does not meet the validation rules, the protocol configuration platform will give a corresponding error prompt and ask the user to re-enter. After the configuration is completed, the protocol configuration platform will verify the connection information parameters to ensure that all fields and attributes have been configured correctly and comply with the requirements of the MQTT protocol and the configuration on the server side.

[0035] By utilizing the preset rules of the target template, the protocol configuration platform can automatically configure the connection information parameters according to the target information entered by the user, without the need for the user to manually perform tedious configuration operations. This greatly improves the efficiency of configuration and reduces the possibility of human error. The preset rules are formulated according to the requirements of the MQTT protocol and common configuration requirements, so that the configured connection information parameters can be ensured to meet the protocol standards and best practices. At the same time, by setting the verification rules, the protocol configuration platform can verify whether the information entered by the user meets the requirements, further ensuring the accuracy of the configuration. The user only needs to enter the necessary basic information, and the protocol configuration platform can automatically complete the configuration of the connection information parameters based on this information. This simplifies the user's operation process and reduces the requirements for user expertise, so that even non-professional users can easily complete the configuration of MQTT connections. When configuring the connection information parameters, the protocol configuration platform can automatically apply authentication encryption methods (such as TLS / SSL) to ensure the security of the MQTT connection. At the same time, by setting the verification rules, the protocol configuration platform can prevent users from entering unsafe configuration information, such as weak passwords or unsupported encryption methods, thereby enhancing the security of the entire system. Although the system uses preset rules to automatically configure the connection information parameters, it still allows users to fine-tune or modify them according to actual needs. Users can adjust the value of the connection field or modify the property settings to meet specific business needs or optimize performance. This flexible customization capability enables the system to adapt to different application scenarios and user needs.

[0036] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The subject information parameters of the target template are configured according to the second sub-preset rule of the target template and the subject information in the target information, wherein the second sub-preset rule includes a static rule and a dynamic rule, wherein the static rule is a preset fixed subject, and the dynamic rule is a variable subject set using a placeholder.

[0037] Figure 3 Schematic diagram of the process of defining topic types and rules for the MQTT preset template disclosed in the embodiment of the present application, such as Figure 3As shown in the figure, various message types are defined in the protocol template, such as data publishing, data subscription, alarm publishing, alarm subscription, will message, etc. Each message type is described in detail, including the purpose of the message, the allowed operations, the relationship between messages, and the related parameters. For example, data publishing is used to publish the data collected by the device to the specified topic, and data subscription is used to subscribe to the data of a specific topic. The second sub-preset rule includes static rules and dynamic rules, which together define how to configure the topic information parameters. Static rules allow administrators or developers to preset one or more fixed topics for the target template. These topics are determined when the template is created and will not change with the change of the target information. They are usually used for topics that do not change frequently and remain consistent throughout the system. Static rules ensure the consistency and stability of the topic and reduce the possibility of configuration errors. At the same time, it also simplifies the configuration process because users do not need to specify the same topic for each connection. Dynamic rules allow the use of placeholders (such as variables, expressions, etc.) to define topics. These placeholders will be replaced by actual values ​​in the target information during the configuration process to generate a variable topic. This approach allows topics to be customized according to specific connection requirements. Placeholder example: Assume the topic format is "sensor / {deviceId} / data", where "{deviceId}" is a placeholder that will be replaced by the device ID in the target information. Dynamic rules increase the flexibility and scalability of configuration. It allows the system to dynamically generate topics based on different connection requirements without creating a separate template for each connection. In addition, it also supports more complex topic patterns, such as topics based on device ID, geographic location, or other attributes.

[0038] By presetting fixed topics, the protocol configuration platform can automatically fill in these topic information without manual input by users, thereby improving configuration efficiency. At the same time, since these topics are predefined and verified, the accuracy of the configuration is also guaranteed. By using placeholders to set variable topics, the protocol configuration platform can dynamically generate topics based on the target information provided by users, reducing the workload of user configuration and reducing configuration problems caused by manual input errors. Presetting fixed topics helps ensure the consistency of topics within the system and promotes the standardization of the protocol configuration platform. This helps to simplify subsequent development and maintenance work and reduce errors and problems caused by inconsistent topics. Through clear rule definition and configuration process, protocol configuration platform administrators can more easily understand and modify topic configurations, improving the maintainability of the system. The method of setting variable topics using placeholders allows the protocol configuration platform to support more topic formats and change modes. When you need to add new devices, data sources, or business scenarios, you only need to define the corresponding placeholders and rules to easily expand the system's topic configuration capabilities.

[0039] Optionally, configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The content information parameters of the target template are configured according to the third sub-preset rule of the target template and the content information in the target information, wherein the third sub-preset rule includes defining the data structure, data type, field name, data format and time format of the message payload.

[0040] Figure 4 Schematic diagram of the main information of the message format defined by the MQTT preset template disclosed in the embodiment of the present application, such as Figure 4 As shown, the message format configuration is mainly the format configuration of the payload, including the data structure, data type, field name, data format and time format of the message content. It supports custom formats based on JSON, XML or other syntaxes.

[0041] The third sub-preset rule refers to the part of the rules used to configure the content information parameters in the preset rules of the target template. These rules define in detail the values ​​of the content information parameters to be set according to the input data. According to the third sub-preset rule, determine the data structure of the message payload (i.e., the content information). This can be a simple key-value pair or a complex nested structure. Define the data type, such as string, integer, floating point number, date and time, etc., and ensure that the input data matches the defined data type. According to the third sub-preset rule, assign a unique name to each data field. These names will be used to reference and display the data in the template. For string type data, you may need to specify its format, such as whether spaces are allowed, maximum length limit, etc. For date and time type data, you need to specify the time format, such as "YYYY-MM-DD HH:mm:ss" or "MM / DD / YYYY", etc. Extract the content information part of the target information. This can be achieved by parsing the data structure in JSON, XML or other formats. Compare and match with the third sub-preset rule according to the actual structure and data type of the content information. Assign the extracted and processed content information to the corresponding content information parameters in the target template. If there is a mismatch or conflict between the target information and the preset rules, a corresponding error handling mechanism needs to be adopted, such as ignoring mismatched data, replacing it with default values, recording error logs, etc.

[0042] The message payload data structure defined by preset rules ensures that the data has a consistent structure and format during transmission, storage or processing. The clear definition of data types reduces errors caused by data type mismatches and ensures data accuracy. The carefully designed data structure makes data processing more efficient and reduces unnecessary parsing and conversion steps. According to the preset rules, the protocol configuration platform can quickly verify the input data to ensure that the data meets the expected format and requirements, thereby improving processing efficiency. Allowing users or developers to customize field names according to actual needs increases the flexibility of the protocol configuration platform. When business needs change, you can adapt to the new data structure by modifying the preset rules without making large-scale modifications to the protocol configuration platform. By defining detailed requirements such as data format and time format, protocol configuration platform errors and failures caused by format errors are reduced. The protocol configuration platform can verify data when it is input, avoiding errors that are discovered during subsequent processing. Due to the standardized and unified data format and structure, the data is more accurate and easy to understand when presented to users. Efficient data processing enables the protocol configuration platform to respond to user requests more quickly, improving user experience.

[0043] S130, determining a service quality level according to the demand, determining a publishing frequency and a number of subscription topics according to a current network state, and configuring a second parameter of the target template according to the service quality level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; The Quality of Service (QoS) level is a parameter used to describe the performance of the service agreed upon between the service provider and the user. When determining the QoS level, business requirements and resource constraints are usually considered. Determine the publishing frequency and the number of subscription topics based on the current network status. The publishing frequency refers to the rate at which messages are published, while the number of subscription topics refers to the number of different message topics to which the user subscribes. These two parameters are directly affected by the current network status. Network bandwidth: Network bandwidth limits the data transmission rate, which in turn affects the publishing frequency. If the bandwidth is low, the publishing frequency needs to be reduced to reduce network congestion. Network latency: Network latency affects the real-time nature of messages. In a high-latency network environment, the publishing frequency may need to be adjusted to accommodate the latency. Network stability: An unstable network may cause message loss or retransmission, which affects the choice of the number of subscription topics. In an unstable environment, the number of subscription topics may need to be reduced to reduce the failure rate.

[0044] The second parameter of the target template includes the publish and subscribe logic and the publish and subscribe strategy, which need to be configured according to the determined QoS level, publishing frequency and number of subscription topics. Publish and subscribe logic: defines the message publishing process and the subscriber processing process, which includes mechanisms such as message distribution, filtering, routing, and subscriber registration, deregistration, and message reception. Specific strategies are formulated based on the QoS level, publishing frequency and number of subscription topics. For example, at high QoS levels, more reliable transmission protocols and retransmission mechanisms may need to be adopted; in low-bandwidth environments, compression technology may need to be used to reduce message size; in scenarios with a large number of subscription topics, a distributed architecture may need to be used to improve processing capabilities.

[0045] Optionally, determining the service quality level according to the demand and determining the publishing frequency and the number of subscription topics according to the current network status includes: Determine the service quality level based on real-time requirements and the importance of data; Determine whether the current network delay is greater than a threshold, and when the current network delay is greater than the threshold, reduce the publishing frequency and reduce the number of subscribed topics; and when the network delay is less than or equal to the threshold, increase the publishing frequency and expand the number of subscribed topics.

[0046] The quality of service (QoS) level is an important indicator used to measure the performance of system services. When determining the QoS level, it is necessary to consider the real-time requirements and the importance of the data. Real-time requirements: Different businesses have different real-time requirements. For example, some real-time monitoring or alarm systems require extremely high real-time performance, while some data backup or logging systems have lower real-time requirements. According to business needs, different real-time levels can be set, such as "immediate response", "second-level response", "minute-level response", etc. The importance of data: The importance of data also affects the determination of QoS levels. For critical business data, a higher QoS level is required to ensure the integrity and reliability of the data. For some non-critical data, the QoS level can be appropriately lowered. Based on the real-time requirements and the importance of the data, a suitable QoS level can be determined. This level will serve as the basis for subsequent configuration of the publishing frequency and the number of subscription topics.

[0047] Determine the publishing frequency and number of subscribed topics based on the current network status. Monitor network latency: Monitor the current network latency in real time, that is, the time required for data to travel from the sender to the receiver. The size of the network latency reflects the real-time performance of the network. Set latency threshold: Set a reasonable latency threshold based on business needs and network conditions. This threshold can be adjusted according to actual conditions to ensure that the publishing frequency and number of subscribed topics can be adjusted in time when the network condition is poor. When the current network latency is greater than the threshold, it means that the network condition is poor and real-time performance cannot be guaranteed. At this time, the publishing frequency should be appropriately reduced to reduce network congestion and message delay. The specific reduction can be adjusted according to the actual situation of the network latency. When the network latency is less than or equal to the threshold, it means that the network condition is good and can meet the real-time requirements. At this time, the publishing frequency can be appropriately increased to improve the data update speed and real-time performance. When the network latency is large, in order to reduce the network burden and reduce the failure rate, the number of subscribed topics should be appropriately reduced. This can reduce the amount of data transmission and reduce the risk of network congestion. When the network latency is small, the number of subscribed topics can be expanded to meet the needs of more users. However, it should be noted that too many subscription topics may increase the processing burden of the system, so it is necessary to ensure the stability and performance of the system while expanding the number.

[0048] By determining the service quality level according to the real-time requirements, the protocol configuration platform can ensure the timely delivery of key information and meet the high real-time requirements of users. The QoS level is adjusted according to the importance of the data to ensure that important data is given higher priority and more reliable protection during the transmission process. When the network delay is large, reducing the publishing frequency can reduce network congestion and avoid wasting network resources; when the network condition is good, increasing the publishing frequency can make full use of network resources and improve data transmission efficiency. Adjusting the number of subscription topics according to the network delay can not only ensure the delivery of key information, but also avoid excessive consumption of network resources in non-critical scenarios. Reducing the publishing frequency and reducing the number of subscription topics when the network delay is large can help prevent network congestion and reduce service interruptions or data loss caused by network problems. By dynamically adjusting the publishing frequency and the number of subscription topics, the protocol configuration platform can optimize the data transmission path and strategy to ensure the stability and reliability of data during transmission. According to the real-time requirements, data importance and network status, the protocol configuration platform can flexibly adjust service parameters to meet the needs of different scenarios. This dynamic adjustment strategy makes the protocol configuration platform easier to expand and maintain, and can be adjusted and optimized accordingly as the business develops and changes.

[0049] Optionally, configuring the second parameter of the target template according to the service quality level, publishing frequency, and number of subscription topics includes: Set different priorities for messages according to the importance and urgency of the business, sort messages according to priority in the message queue, and dynamically adjust the priority of messages according to system status and business needs; The target device to receive the message is determined based on business requirements and basic information of the device, where the basic information includes the geographical location, type, and function of the device.

[0050] Set different priorities for each message based on the importance and urgency of the business. Priority can be a numerical value, with lower numerical values ​​indicating higher priority. In the message queue, messages are sorted according to their priority. High-priority messages are placed at the front of the queue so that they can be processed and sent earlier. The priority of messages can be adjusted dynamically based on the protocol configuration platform status and business needs. For example, when a business encounters an emergency, the priority of its related messages can be temporarily increased. Clarify the specific needs of the business, including the type, geographic location, and function of the target device that needs to receive the message. Obtain basic information about the device, including the geographic location, type, and function of the device. This information can be obtained through device registration, configuration, or query. Based on business needs and basic information about the device, the protocol configuration platform can determine which devices are target devices, that is, devices that need to receive the current message.

[0051] By sorting priorities, the protocol configuration platform can prioritize important and urgent messages, ensuring that these messages can be processed and responded to in a timely manner, thereby optimizing resource allocation. High-priority messages will be processed first, thereby improving the response speed of the protocol configuration platform and meeting users' needs for real-time and rapid response. The ability to dynamically adjust priorities enables the protocol configuration platform to flexibly adjust resource allocation according to business changes and the status of the protocol configuration platform, improving the adaptability and flexibility of the protocol configuration platform. By matching business needs and basic device information, the protocol configuration platform can accurately determine the target device that needs to receive messages, avoiding mis-sending and waste of messages. Based on the device's geographical location, type, function and other information, the protocol configuration platform can provide personalized services for different devices to meet the needs of different devices. By accurately matching the target device, the protocol configuration platform can avoid unnecessary network communication and data processing, thereby optimizing resource utilization.

[0052] Optionally, configuring the second parameter of the target template according to the service quality level, publishing frequency, and number of subscription topics includes: The parameters of the target template error detection mechanism and the retry mechanism are configured according to the service quality level, publishing frequency and number of subscription topics. The error detection mechanism includes determining errors through heartbeat detection and timeout judgment, and performing repair processing according to the error type and severity. The retry mechanism includes resending the message according to the configured number of retries and retry interval when the message fails to be sent.

[0053] The error detection mechanism is mainly used to monitor and identify errors that may occur during message transmission. It usually includes two main parts: heartbeat detection and timeout judgment. Heartbeat detection is a mechanism that periodically sends short messages (called heartbeat packets) to confirm that both communicating parties are still online and working normally. If the receiver does not receive the sender's heartbeat packet within a period of time, it will think that the sender may have failed or is offline. Timeout judgment is achieved by setting a time threshold. If an operation (such as message sending or receiving) is not completed within the set time threshold, the system will consider that the operation has timed out and may trigger the error handling process. When an error is detected, the system will perform corresponding repair processing based on the type and severity of the error. Repair processing may include re-establishing the connection, resending the message, recording the error log, etc.

[0054] The retry mechanism is a mechanism for resending messages according to the configured number of retries and retry interval when a message fails to be sent. The number of retries is the number of times the system allows retry attempts after a message fails to be sent. When a message fails to be sent, the system will make multiple attempts according to the configured number of retries until it is successfully sent or the maximum number of retries is reached. The retry interval is the time interval between each resend of the message. The system will wait for a period of time according to the configured retry interval before trying to send the message again. This can avoid frequent failed message sending in a short period of time and reduce the burden on the system.

[0055] When configuring the second parameter of the target template according to the QoS level, publishing frequency, and number of subscribed topics, the parameters of the error detection mechanism and the retry mechanism can be adjusted according to these factors. For example, for services with higher QoS levels, stricter heartbeat detection thresholds and shorter timeouts can be set to ensure real-time and reliability of communication. At the same time, for services with higher publishing frequencies or a large number of subscribed topics, the number of retries and the retry interval can be appropriately increased to reduce message loss and delays caused by network congestion or transient failures.

[0056] Through heartbeat detection and timeout judgment, the protocol configuration platform can promptly detect network failures or data transmission problems and take corresponding measures to repair them, thereby ensuring the reliability of data transmission. During the data transmission process, if an error or failure occurs, the protocol configuration platform can detect and repair it in time, reducing the risk of data loss. The error detection mechanism can enhance the robustness of the protocol configuration platform, so that the protocol configuration platform can still maintain stable operation in the face of network failures or data transmission problems. Through the retry mechanism, the protocol configuration platform can automatically resend messages when they fail to send, thereby improving the success rate of message delivery. Reasonable configuration of the number of retries and retry intervals can avoid unnecessary network congestion and waste of resources. For users, even in poor network conditions, the retry mechanism can ensure that messages can be successfully delivered, thereby enhancing the user experience.

[0057] S140. Create an MQTT connection service according to the configured target template to achieve communication and data exchange between target devices.

[0058] Figure 5 is a flow chart of applying the MQTT preset template disclosed in the embodiment of the present application, such as Figure 5 As shown, applying the MQTT preset template includes step S510, starting to create an MQTT service; step S520, determining whether the target template already exists; when the target template already exists, executing step S530, selecting the corresponding target template; when the target template does not exist, executing step S540, creating the target template; after executing step S530, executing step S550, filling in the connection information; executing step S560, creating a topic; executing step S570, configuring the message content; executing step S580, formulating a corresponding strategy.

[0059] This embodiment also discloses a configuration system for a personalized MQTT protocol. Figure 6 It is a module diagram of the configuration system of the personalized MQTT protocol disclosed in the embodiment of the present application, such as Figure 6 As shown, the configuration system includes a judgment module 601, a first configuration module 602, a second configuration module 603 and an execution module 604, wherein: The judgment module 601 is configured to respond to the operation of the user inputting a requirement and judge whether a target template can be matched from the preset templates according to the requirement; The first configuration module 602 is configured to extract target information from the basic information in response to the user inputting basic information when a target template can be matched from the preset template according to the requirement, and configure first parameters of the target template according to the preset rule of the target template and the target information, wherein the first parameters include connection information parameters, subject information parameters and content information parameters; A second configuration module 603 is configured to determine a service quality level according to the demand, determine a publishing frequency and a number of subscription topics according to a current network state, and configure a second parameter of the target template according to the service quality level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; The execution module 604 is configured to create an MQTT connection service according to the configured target template to achieve communication and data exchange between target devices.

[0060] Optionally, the first configuration module 602 is configured to: The connection information parameters of the target template are configured according to the first sub-preset rule of the target template and the connection information in the target information. The connection information parameters include a connection field and attributes corresponding to the connection field. The connection field includes the host address, port number, user name, password, and authentication encryption method required to connect to the MQTT server. The attributes include data types, association relationships, and verification rules.

[0061] Optionally, the first configuration module 602 is configured to: The subject information parameters of the target template are configured according to the second sub-preset rule of the target template and the subject information in the target information, wherein the second sub-preset rule includes a static rule and a dynamic rule, wherein the static rule is a preset fixed subject, and the dynamic rule is a variable subject set using a placeholder.

[0062] Optionally, the first configuration module 602 is configured to: The content information parameters of the target template are configured according to the third sub-preset rule of the target template and the content information in the target information, wherein the third sub-preset rule includes defining the data structure, data type, field name, data format and time format of the message payload.

[0063] Optionally, the second configuration module 603 is configured to: Determine the service quality level based on real-time requirements and the importance of data; Determine whether the current network delay is greater than a threshold, and when the current network delay is greater than the threshold, reduce the publishing frequency and reduce the number of subscribed topics; and when the network delay is less than or equal to the threshold, increase the publishing frequency and expand the number of subscribed topics.

[0064] Optionally, the second configuration module 603 is configured to: Set different priorities for messages according to the importance and urgency of the business, sort messages according to priority in the message queue, and dynamically adjust the priority of messages according to system status and business needs; The target device to receive the message is determined based on business requirements and basic information of the device, where the basic information includes the geographical location, type, and function of the device.

[0065] Optionally, the second configuration module 603 is configured to: The parameters of the target template error detection mechanism and the retry mechanism are configured according to the service quality level, publishing frequency and number of subscription topics. The error detection mechanism includes determining errors through heartbeat detection and timeout judgment, and performing repair processing according to the error type and severity. The retry mechanism includes resending the message according to the configured number of retries and retry interval when the message fails to be sent.

[0066] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0067] This embodiment also discloses an electronic device, referring to Figure 7 The electronic device may include: at least one processor 701 , at least one communication bus 702 , a user interface 703 , a network interface 704 , and at least one memory 705 .

[0068] The communication bus 702 is used to realize the connection and communication between these components.

[0069] The user interface 703 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 703 may also include a standard wired interface and a wireless interface.

[0070] The network interface 704 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0071] Among them, the processor 701 may include one or more processing cores. The processor 701 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 705, and calling data stored in the memory 705. Optionally, the processor 701 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 701 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 701, and it can be implemented separately through a chip.

[0072] Among them, the memory 705 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 705 includes a non-transitory computer-readable storage medium. The memory 705 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 705 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 705 may also be optionally at least one storage device located away from the aforementioned processor 701. As Figure 7 As shown, the memory 705 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program for a personalized MQTT protocol configuration method.

[0073] exist Figure 7In the electronic device shown, the user interface 703 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 701 can be used to call the application program for storing the configuration method of the personalized MQTT protocol in the memory 705. When executed by one or more processors 701, the electronic device executes one or more methods in the above-mentioned embodiments.

[0074] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0075] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0077] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0078] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0079] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory 705 and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory 705 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0080] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, it will be easy for those skilled in the art to think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A configuration method for a personalized MQTT protocol, characterized in that: Applied to the protocol configuration platform, the configuration method includes: In response to a user input operation of a requirement, determining whether a target template can be matched from a preset template according to the requirement; When a target template can be matched from a preset template according to the requirement, in response to an operation of a user inputting basic information, target information is extracted from the basic information, and a first parameter of the target template is configured according to a preset rule of the target template and the target information, wherein the first parameter includes a connection information parameter, a subject information parameter, and a content information parameter; Determine a quality of service level according to the demand, determine a publishing frequency and a number of subscription topics according to a current network state, and configure a second parameter of the target template according to the quality of service level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; Create an MQTT connection service based on the configured target template to achieve communication and data exchange between target devices.

2. The configuration method of the personalized MQTT protocol according to claim 1, characterized in that: The configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The connection information parameters of the target template are configured according to the first sub-preset rule of the target template and the connection information in the target information. The connection information parameters include a connection field and attributes corresponding to the connection field. The connection field includes the host address, port number, user name, password, and authentication encryption method required to connect to the MQTT server. The attributes include data types, association relationships, and verification rules.

3. The configuration method of the personalized MQTT protocol according to claim 1, characterized in that: The configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The subject information parameters of the target template are configured according to the second sub-preset rule of the target template and the subject information in the target information, wherein the second sub-preset rule includes a static rule and a dynamic rule, wherein the static rule is a preset fixed subject, and the dynamic rule is a variable subject set using a placeholder.

4. The configuration method of the personalized MQTT protocol according to claim 1, characterized in that: The configuring the first parameter of the target template according to the preset rule of the target template and the target information includes: The content information parameters of the target template are configured according to the third sub-preset rule of the target template and the content information in the target information, wherein the third sub-preset rule includes defining the data structure, data type, field name, data format and time format of the message payload.

5. The configuration method of the personalized MQTT protocol according to claim 1, characterized in that: Determining the service quality level according to the demand and determining the publishing frequency and the number of subscription topics according to the current network status includes: Determine the service quality level based on real-time requirements and the importance of data; Determine whether the current network delay is greater than a threshold, and when the current network delay is greater than the threshold, reduce the publishing frequency and reduce the number of subscribed topics; and when the network delay is less than or equal to the threshold, increase the publishing frequency and expand the number of subscribed topics.

6. The method for configuring the personalized MQTT protocol according to claim 1, characterized in that: The second parameter of configuring the target template according to the service quality level, publishing frequency and number of subscription topics includes: Set different priorities for messages according to the importance and urgency of the business, sort messages according to priority in the message queue, and dynamically adjust the priority of messages according to system status and business needs; The target device to receive the message is determined based on business requirements and basic information of the device, where the basic information includes the geographical location, type, and function of the device.

7. The configuration method of the personalized MQTT protocol according to claim 1, characterized in that: The second parameter of configuring the target template according to the service quality level, publishing frequency and number of subscription topics includes: The parameters of the target template error detection mechanism and the retry mechanism are configured according to the service quality level, publishing frequency and number of subscription topics. The error detection mechanism includes determining errors through heartbeat detection and timeout judgment, and performing repair processing according to the error type and severity. The retry mechanism includes resending the message according to the configured number of retries and retry interval when the message fails to be sent.

8. A personalized MQTT protocol configuration system, characterized in that: It includes a judgment module, a first configuration module, a second configuration module and an execution module, wherein: A judgment module, configured to respond to the operation of the user input requirement and judge whether a target template can be matched from the preset templates according to the requirement; A first configuration module is configured to extract target information from the basic information in response to an operation of a user inputting basic information when a target template can be matched from a preset template according to the requirement, and configure first parameters of the target template according to a preset rule of the target template and the target information, wherein the first parameters include a connection information parameter, a theme information parameter, and a content information parameter; a second configuration module configured to determine a service quality level according to the demand, determine a publishing frequency and a number of subscription topics according to a current network state, and configure a second parameter of the target template according to the service quality level, the publishing frequency and the number of subscription topics, wherein the second parameter includes a publishing and subscription logic and a publishing and subscription strategy; The execution module is configured to create an MQTT connection service according to the configured target template to achieve communication and data exchange between target devices.

9. An electronic device, characterized in that: It includes a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.

Citation Information

Cited By

  • Distributed multi-task satellite-borne application message interaction system based on MQTT

    CN119814747A

  • Remote database remote data reporting method and system and medium

    CN120295816A