Data transmission method and device based on dual-entry protocol conversion platform

By adopting a dual-ingress protocol conversion platform in the Internet of Things and distributed systems, the conversion and load balancing between MQTT and TCP protocols is achieved, and the system crash caused by the failure of a single ingress gateway is solved, and the reliability and availability of the system are improved.

CN118972471APending Publication Date: 2024-11-15GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411353746.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

In IoT and distributed systems, the communication protocol conversion between different devices and systems adopts a single inlet gateway, resulting in the entire system not working properly in the event of a failure and lacks an effective solution.

Method used

The dual-ingress protocol conversion platform is adopted, and the MQTT protocol and TCP protocol messages are converted through the MQTT gateway and the TCP gateway respectively, and the load balancer is used to allocate traffic to ensure that the system automatically switches to the backup gateway in the event of a failure.

Benefits of technology

Improve the reliability and availability of IoT and distributed systems, ensure the stable operation of the system in high concurrency and failure situations, and avoid system crashes caused by single inlet gateway failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972471A_ABST
    Figure CN118972471A_ABST
Patent Text Reader

Abstract

The invention discloses a data transmission method and device based on a dual-entry protocol conversion platform. The method comprises the following steps: determining a protocol type of a request message and a receiving equipment type of the request message; when the protocol type is an MQTT protocol and the receiving equipment type is TCP equipment, converting the request message into a TCP protocol message through an MQTT gateway in the dual-entry protocol conversion platform, and sending the TCP protocol message to the TCP equipment; and when the protocol type is a TCP protocol and the type of the receiving equipment is MQTT equipment, converting the request message into an MQTT protocol message through a TCP gateway in the dual-entry protocol conversion platform, and sending the MQTT protocol message to the MQTT equipment. According to the invention, the technical problem that the whole system cannot work when a fault occurs due to the fact that communication protocol conversion between different devices and systems is completed by adopting a single entrance gateway in the Internet of Things and a distributed system in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a data transmission method and device based on a dual-entry protocol conversion platform. Background Art

[0002] In the Internet of Things and distributed systems, different devices and systems may use different communication protocols, such as MQTT and TCP. This makes it difficult to uniformly control and manage the system. In the prior art, a single entry gateway is usually used for protocol conversion, but this approach will not work properly if there is a problem with the gateway or service middleware.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiment of the present invention provides a data transmission method and device based on a dual-entry protocol conversion platform, so as to at least solve the technical problem in the related technology that in the Internet of Things and distributed systems, the communication protocol conversion between different devices and systems is completed by a single entry gateway, which causes the entire system to fail to work when a failure occurs.

[0005] According to one aspect of an embodiment of the present invention, a data transmission method based on a dual-entry protocol conversion platform is provided, wherein the dual-entry protocol conversion platform is used to perform protocol conversion between a lightweight communication protocol MQTT and a transmission control protocol TCP, including: upon receiving a request message from a client, determining the protocol type of the request message and the receiving device type of the request message, wherein the receiving device type is the device type of the receiving device indicated by the request message; when the protocol type is the MQTT protocol and the receiving device type is a TCP device, converting the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and sending the TCP protocol message to the TCP device; when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the TCP gateway in the dual-entry protocol conversion platform converts the request message into an MQTT protocol message, and sends the MQTT protocol message to the MQTT device.

[0006] Optionally, determining the protocol type of the request message and the type of receiving device of the request message includes: parsing the request message to obtain a first parsing result of the request message; determining the protocol type of the request message based on the first parsing result, and determining the type of receiving device of the request message based on the first parsing result.

[0007] Optionally, when receiving a request message from a client, before determining the protocol type of the request message and the type of receiving device of the request message, the data transmission method based on a dual-entry protocol conversion platform also includes: sending a TCP connection request to the client, wherein the TCP connection request is used to request to establish a TCP connection with the client, and the TCP connection is used to perform TCP protocol data transmission with the client; when receiving feedback information from the client, determining that the TCP connection with the client is successfully established.

[0008] Optionally, when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the request message is converted into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device, including: using the TCP gateway to parse the request message to obtain a second parsing result; extracting TCP data from the second parsing result; using the TCP gateway to convert the TCP data into the MQTT protocol message, wherein the MQTT protocol message includes: message subject, message content, and service quality level; sending the MQTT protocol message to the MQTT client, so as to use the MQTT client to send the MQTT protocol message to the MQTT agent, and send the MQTT protocol to the MQTT device through the MQTT agent.

[0009] Optionally, the data transmission method based on the dual-entry protocol conversion platform also includes: when receiving a first TCP response message from the TCP device, converting the first TCP response message into a first MQTT response message through the MQTT gateway; and publishing the first MQTT response message to a corresponding MQTT topic.

[0010] Optionally, the data transmission method based on the dual-entry protocol conversion platform also includes: when receiving a second MQTT response message from the MQTT device, converting the second MQTT response message into a second TCP response message through the TCP gateway; and sending the second TCP response message to the TCP client.

[0011] Optionally, when receiving a request message from a client, after determining the protocol type of the request message, the data transmission method based on a dual-entry protocol conversion platform further includes: when the protocol type is the MQTT protocol, using a load balancer to distribute traffic among each of the MQTT gateways according to the current traffic size of each of the MQTT gateways, so as to send the request message to the corresponding MQTT gateway for processing; when the protocol type is the TCP protocol, using the load balancer to distribute traffic among each of the TCP gateways according to the current traffic size of each of the TCP gateways, so as to send the request message to the corresponding TCP gateway for processing.

[0012] According to another aspect of an embodiment of the present invention, a data transmission device based on a dual-entry protocol conversion platform is also provided, wherein the dual-entry protocol conversion platform is used to perform protocol conversion between a lightweight communication protocol MQTT and a transmission control protocol TCP, and includes: a first determination module, used to determine the protocol type of the request message and the receiving device type of the request message when receiving a request message from a client, wherein the receiving device type is the device type of the receiving device indicated by the request message; a first processing module, used to convert the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform when the protocol type is the MQTT protocol and the receiving device type is a TCP device, and send the TCP protocol message to the TCP device; a second processing module, used to convert the request message into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform when the protocol type is the TCP protocol and the receiving device type is the MQTT device, and send the MQTT protocol message to the MQTT device.

[0013] Optionally, the first determination module includes: a first parsing unit, used to parse the request message to obtain a first parsing result of the request message; a determination unit, used to determine the protocol type of the request message according to the first parsing result, and determine the receiving device type of the request message according to the first parsing result.

[0014] Optionally, the data transmission device based on the dual-entry protocol conversion platform also includes: a sending module, which is used to send a TCP connection request to the client before determining the protocol type of the request message and the receiving device type of the request message when receiving a request message from the client, wherein the TCP connection request is used to request to establish a TCP connection with the client, and the TCP connection is used to perform TCP protocol data transmission with the client; a second determination module, which is used to determine that the TCP connection with the client is successfully established when feedback information from the client is received.

[0015] Optionally, the second processing module includes: a second parsing unit, used to parse the request message using the TCP gateway to obtain a second parsing result; an extraction unit, used to extract TCP data from the second parsing result; a first conversion unit, used to convert the TCP data into the MQTT protocol message using the TCP gateway, wherein the MQTT protocol message includes: message subject, message content, and service quality level; a processing unit, used to send the MQTT protocol message to the MQTT client, so as to use the MQTT client to send the MQTT protocol message to the MQTT agent, and send the MQTT protocol to the MQTT device through the MQTT agent.

[0016] Optionally, the data transmission device based on the dual-entry protocol conversion platform also includes: a second conversion unit, used to convert the first TCP response message into a first MQTT response message through the MQTT gateway when receiving the first TCP response message from the TCP device; and a publishing unit, used to publish the first MQTT response message to the corresponding MQTT topic.

[0017] Optionally, it also includes: a third conversion unit, used to convert the second MQTT response message into a second TCP response message through the TCP gateway when receiving the second MQTT response message from the MQTT device; and a sending unit, used to send the second TCP response message to the TCP client.

[0018] Optionally, when receiving a request message from the client, after determining the protocol type of the request message, the data transmission device based on the dual-entry protocol conversion platform also includes: a first allocation unit, which is used to use a load balancer to distribute traffic among each MQTT gateway according to the current traffic size of each MQTT gateway when the protocol type is the MQTT protocol, so as to send the request message to the corresponding MQTT gateway for processing; a second allocation unit, which is used to use the load balancer to distribute traffic among each TCP gateway according to the current traffic size of each TCP gateway when the protocol type is the TCP protocol, so as to send the request message to the corresponding TCP gateway for processing.

[0019] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the program executes any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform.

[0020] According to another aspect of an embodiment of the present invention, a processor is provided, which is used to run a program, wherein the program executes any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform when running.

[0021] According to another aspect of an embodiment of the present invention, a computer program product is provided, including computer instructions, which, when executed by a processor, perform any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform.

[0022] In an embodiment of the present invention, when a request message is received from a client, the protocol type of the request message and the receiving device type of the request message are determined, wherein the receiving device type is the device type of the receiving device indicated by the request message; when the protocol type is the MQTT protocol and the receiving device type is the TCP device, the request message is converted into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and the TCP protocol message is sent to the TCP device; when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the TCP gateway in the dual-entry protocol conversion platform converts the request message into an MQTT protocol message, and the MQTT protocol message is sent to the MQTT device. Through the technical solution provided by the present invention, the purpose of protocol conversion between MQTT and TCP is achieved by combining the dual-entry design and the protocol conversion platform, thereby improving the reliability of the Internet of Things and distributed systems, thereby solving the technical problem that the communication protocol conversion between different devices and systems in the Internet of Things and distributed systems in the related technology is completed by using a single entry gateway, which causes the entire system to fail to work when a failure occurs. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0024] Figure 1 It is a hardware structure block diagram of a mobile terminal of a data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention;

[0025] Figure 2 is a flow chart of a data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention;

[0026] Figure 3 is a flow chart of an optional data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention;

[0027] Figure 4 is a schematic diagram of a data transmission device based on a dual-entry protocol conversion platform according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] As introduced in the background technology, in the related art, in the Internet of Things and distributed systems, the communication protocol conversion between different devices and systems is completed using a single entry gateway, which causes the entire system to fail to work when a failure occurs. In view of the above defects, in the embodiments of the present invention, a data transmission method and device based on a dual-entry protocol conversion platform, a computer-readable storage medium, a processor, and a computer program product are provided.

[0031] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0032] The method embodiments provided in the embodiments of the present invention can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 1 is a hardware structure block diagram of a mobile terminal of a data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0033] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data transmission method based on the dual-entry protocol conversion platform in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific examples of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0034] According to an embodiment of the present invention, a method embodiment of a data transmission method based on a dual-entry protocol conversion platform is provided. It should be noted that the dual-entry protocol conversion platform is used to perform protocol conversion between a lightweight communication protocol MQTT and a transmission control protocol TCP. The steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0035] Figure 2 is a flow chart of a data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention, such as Figure 2 As shown, the data transmission method based on the dual-entry protocol conversion platform includes the following steps:

[0036] Step S202: upon receiving a request message from the client, determining the protocol type of the request message and the receiving device type of the request message, wherein the receiving device type is the device type of the receiving device indicated by the request message.

[0037] Optionally, the request message may include but is not limited to a control message and a query request sent by the client.

[0038] In this embodiment, when a request message sent by a client is received, the request message may be parsed to obtain the protocol type of the request message and the device type of the receiving device, thereby facilitating forwarding of the request message.

[0039] Step S204, when the protocol type is the MQTT protocol and the receiving device type is a TCP device, the MQTT gateway in the dual-entry protocol conversion platform converts the request message into a TCP protocol message and sends the TCP protocol message to the TCP device.

[0040] In this embodiment, when the protocol type determined above is the MQTT protocol and the device type of the receiving device is a TCP device, the request message can be converted into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and then the TCP protocol message is sent to the TCP device.

[0041] Step S206, when the protocol type is TCP protocol and the receiving device type is MQTT device, the request message is converted into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device.

[0042] In this embodiment, when the protocol type determined above is the TCP protocol and the device type of the receiving device is an MQTT device, the request message can be converted into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and then the MQTT protocol message is sent to the MQTT device.

[0043] From the above, it can be seen that in an embodiment of the present invention, when a request message is received from a client, the protocol type of the request message and the receiving device type of the request message are determined, wherein the receiving device type is the device type of the receiving device indicated by the request message; when the protocol type is the MQTT protocol and the receiving device type is a TCP device, the MQTT gateway in the dual-entry protocol conversion platform converts the request message into a TCP protocol message, and sends the TCP protocol message to the TCP device; when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the TCP gateway in the dual-entry protocol conversion platform converts the request message into an MQTT protocol message, and sends the MQTT protocol message to the MQTT device, thereby achieving the purpose of protocol conversion between MQTT and TCP by combining the dual-entry design and the protocol conversion platform, and improving the reliability of the Internet of Things and distributed systems.

[0044] Therefore, the above-mentioned technical solution provided by the embodiment of the present invention solves the technical problem in the related technology that in the Internet of Things and distributed systems, the communication protocol conversion between different devices and systems is completed by a single entry gateway, which causes the entire system to fail to work when a failure occurs.

[0045] It should be noted that the above-mentioned MQTT and TCP are two different communication protocols. Devices usually choose one of them for communication, and the protocols can be converted through a protocol conversion platform.

[0046] According to the above-mentioned embodiment of the present invention, determining the protocol type of the request message and the type of the receiving device of the request message may include: parsing the request message to obtain a first parsing result of the request message; determining the protocol type of the request message according to the first parsing result, and determining the type of the receiving device of the request message according to the first parsing result.

[0047] In this embodiment, after receiving the request message, the request message may be parsed, and the protocol type and receiving device type of the request message may be determined according to the parsing result.

[0048] According to the above-mentioned embodiment of the present invention, when receiving a request message from a client, before determining the protocol type of the request message and the type of receiving device of the request message, the data transmission method based on the dual-entry protocol conversion platform may also include: sending a TCP connection request to the client, wherein the TCP connection request is used to request to establish a TCP connection with the client, and the TCP connection is used to perform TCP protocol data transmission with the client; when receiving feedback information from the client, it is determined that the TCP connection with the client is successfully established.

[0049] In this embodiment, when converting between TCP and MQTT protocols, a middleware or gateway is usually required to implement it. Specifically, a TCP connection can be established first, for example, a TCP connection can be established between a client and a server, and this connection can be used to transmit original data.

[0050] According to the above embodiment of the present invention, when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the request message is converted into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device, including: using the TCP gateway to parse the request message to obtain a second parsing result; extracting TCP data from the second parsing result; using the TCP gateway to convert the TCP data into an MQTT protocol message, wherein the MQTT protocol message includes: message subject, message content, and service quality level; sending the MQTT protocol message to the MQTT client, so as to use the MQTT client to send the MQTT protocol message to the MQTT agent, and send the MQTT protocol to the MQTT device through the MQTT agent.

[0051] In this embodiment, the TCP data may be parsed first: after receiving the TCP data, the data needs to be parsed to extract useful information; then the MQTT message is constructed: the parsed data is converted into an MQTT message. The MQTT message here may include: topic (Topic), message content (Payload), QoS (Quality of Service) level and other information.

[0052] In addition, for the publication of MQTT messages, you can use the MQTT client library (such as Paho, Mosquitto, etc.) to publish the constructed MQTT message to the specified MQTT broker (Broker). In addition, for message subscription and response, if you need to receive a response from the MQTT broker, you need to subscribe to the relevant MQTT topic and convert the received MQTT message back to TCP format and send it back to the TCP client.

[0053] According to the above embodiment of the present invention, the data transmission method based on the dual-entry protocol conversion platform also includes: when receiving a first TCP response message from a TCP device, converting the first TCP response message into a first MQTT response message through an MQTT gateway; and publishing the first MQTT response message to a corresponding MQTT topic.

[0054] In this embodiment, when a TCP response message received from a TCP device disappears, the TCP response message can be converted into an MQTT response message through an MQTT gateway, and the MQTT response message can be published to a corresponding MQTT topic.

[0055] According to the above embodiment of the present invention, the data transmission method based on the dual-entry protocol conversion platform also includes: when receiving a second MQTT response message from the MQTT device, converting the second MQTT response message into a second TCP response message through a TCP gateway; and sending the second TCP response message to the TCP client.

[0056] In this embodiment, when the MQTT response received from the MQTT device disappears, the MQTT response message can be converted into a TCP response message through the TCP gateway, and the TCP response message can be published to the corresponding TCP client.

[0057] According to the above embodiment of the present invention, when a request message is received from a client, after determining the protocol type of the request message, the data transmission method based on the dual-entry protocol conversion platform also includes: when the protocol type is the MQTT protocol, using a load balancer to distribute traffic among each MQTT gateway according to the current traffic size of each MQTT gateway, so as to send the request message to the corresponding MQTT gateway for processing; when the protocol type is the TCP protocol, using a load balancer to distribute traffic among each TCP gateway according to the current traffic size of each TCP gateway, so as to send the request message to the corresponding TCP gateway for processing.

[0058] In this embodiment, the dual-entry protocol conversion platform may include multiple MQTT gateways and multiple TCP gateways; when the received request message is a message of the MQTT protocol type, the load balancer can be used to distribute traffic among the MQTT gateways according to the current traffic size of each MQTT gateway, so as to send the request message to the corresponding MQTT gateway for processing; when the protocol type of the received request message is the TCP protocol, the load balancer can be used to distribute traffic among the TCP gateways according to the current traffic size of each TCP gateway, so as to send the request message to the corresponding TCP gateway for processing.

[0059] Figure 3 is a flow chart of an optional data transmission method based on a dual-entry protocol conversion platform according to an embodiment of the present invention, such as Figure 3 As shown, a protocol conversion platform is set up here, through which protocol conversion can be performed between MQTT and TCP, so that TCP devices can be directly controlled and queried through MQTT, and MQTT devices can be directly controlled and queried through TCP devices.

[0060] like Figure 3 As shown, a TCP gateway and an MQTT gateway are set up. MQTT gateway: used to receive control and query requests from MQTT clients, convert MQTT messages into TCP protocol messages, and send them to the corresponding TCP devices; receive responses from TCP devices, convert them back into MQTT messages, and publish them to the corresponding MQTT topics. TCP gateway: used to receive control and query requests from TCP clients, convert TCP messages into MQTT protocol messages, and send them to the corresponding MQTT devices; receive responses from MQTT devices, convert them back into TCP messages, and send them back to the TCP clients.

[0061] Through the above dual-entry design, a dual-entry design is adopted to ensure that the system can still operate normally when a problem occurs in one of the entrances or service middleware. Specifically, two independent gateways are deployed: one handles MQTT requests and the other handles TCP requests. Each gateway can work independently and communicate with the protocol conversion platform. Use a load balancer to distribute traffic or automatically switch to another gateway when one gateway fails. And isolated deployment is also carried out: the MQTT gateway and the TCP gateway are deployed on different physical or virtual machines to ensure that a single point of failure does not affect the entire system. Use containerization technology (such as Docker) and orchestration tools (such as Kubernetes) to manage and deploy gateways to improve the elasticity and scalability of the system.

[0062] In addition, in an embodiment of the present invention, the service middleware can be managed: using a microservice architecture, the protocol conversion function and other service functions are decoupled to facilitate independent deployment and expansion. Message queues (such as Kafka, RabbitMQ) are used to handle communications between different services to improve the reliability and availability of the system. Moreover, through the combination of dual-entry design and protocol conversion platform, unified compatibility and control of MQTT and TCP protocols are achieved, improving the reliability and availability of the system. At the same time, the stable operation of the system is ensured under high concurrency and failure conditions.

[0063] In the above technical solution provided by the embodiment of the present invention, the unified compatibility and control of MQTT and TCP protocols are achieved through the combination of dual-entry design and protocol conversion platform, thereby improving the reliability and availability of the system. When a gateway or service middleware fails, the system can automatically switch to a backup gateway to ensure the continuous operation of the system.

[0064] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, 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 by the present application.

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

[0066] According to an embodiment of the present invention, a data transmission device based on a dual-entry protocol conversion platform for a water heater is provided for implementing the data transmission method based on the dual-entry protocol conversion platform. The dual-entry protocol conversion platform is used for performing protocol conversion between the lightweight communication protocol MQTT and the transmission control protocol TCP. Figure 4 is a schematic diagram of a data transmission device based on a dual-entry protocol conversion platform according to an embodiment of the present invention, such as Figure 4 As shown, the device includes: a first determining module 401, a first processing module 403 and a second processing module 405. The data transmission device based on the dual-entry protocol conversion platform is described below.

[0067] The first determination module 401 is used to determine the protocol type of the request message and the receiving device type of the request message when receiving a request message from the client, wherein the receiving device type is the device type of the receiving device indicated by the request message.

[0068] The first processing module 403 is used to convert the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform when the protocol type is the MQTT protocol and the receiving device type is a TCP device, and send the TCP protocol message to the TCP device.

[0069] The second processing module 405 is used to convert the request message into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform when the protocol type is the TCP protocol and the receiving device type is the MQTT device, and send the MQTT protocol message to the MQTT device.

[0070] It should be noted here that the above-mentioned first determination module 401, first processing module 403 and second processing module 405 correspond to steps S202 to S206 in the above-mentioned embodiment, and the three modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the contents disclosed in the above-mentioned embodiment.

[0071] As can be seen from the above, in the scheme recorded in the above-mentioned embodiment of the present invention, the first determination module can be used to determine the protocol type of the request message and the receiving device type of the request message when receiving the request message from the client, wherein the receiving device type is the device type of the receiving device indicated by the request message; when the protocol type is the MQTT protocol and the receiving device type is the TCP device, the first processing module is used to convert the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and the TCP protocol message is sent to the TCP device; and when the protocol type is the TCP protocol and the receiving device type is the MQTT device, the second processing module is used to convert the request message into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device, thereby achieving the purpose of performing protocol conversion between MQTT and TCP by combining the dual-entry design and the protocol conversion platform, thereby improving the reliability of the Internet of Things and distributed systems.

[0072] Therefore, the above-mentioned technical solution provided by the embodiment of the present invention solves the technical problem in the related technology that in the Internet of Things and distributed systems, the communication protocol conversion between different devices and systems is completed by a single entry gateway, which causes the entire system to fail to work when a failure occurs.

[0073] Optionally, the first determination module includes: a first parsing unit, used to parse the request message to obtain a first parsing result of the request message; a determination unit, used to determine the protocol type of the request message according to the first parsing result, and determine the receiving device type of the request message according to the first parsing result.

[0074] Optionally, the data transmission device based on the dual-entry protocol conversion platform also includes: a sending module, which is used to send a TCP connection request to the client before determining the protocol type of the request message and the receiving device type of the request message when receiving a request message from the client, wherein the TCP connection request is used to request to establish a TCP connection with the client, and the TCP connection is used to perform TCP protocol data transmission with the client; a second determination module, which is used to determine that the TCP connection with the client is successfully established when feedback information from the client is received.

[0075] Optionally, the second processing module includes: a second parsing unit, used to parse the request message using a TCP gateway to obtain a second parsing result; an extraction unit, used to extract TCP data from the second parsing result; a first conversion unit, used to convert the TCP data into an MQTT protocol message using a TCP gateway, wherein the MQTT protocol message includes: a message subject, a message content, and a service quality level; a processing unit, used to send the MQTT protocol message to the MQTT client, so as to use the MQTT client to send the MQTT protocol message to the MQTT agent, and send the MQTT protocol to the MQTT device through the MQTT agent.

[0076] Optionally, the data transmission device based on the dual-entry protocol conversion platform also includes: a second conversion unit, used to convert the first TCP response message into a first MQTT response message through the MQTT gateway when receiving a first TCP response message from a TCP device; and a publishing unit, used to publish the first MQTT response message to a corresponding MQTT topic.

[0077] Optionally, the device also includes: a third conversion unit, used to convert the second MQTT response message into a second TCP response message through a TCP gateway when receiving a second MQTT response message from the MQTT device; and a sending unit, used to send the second TCP response message to a TCP client.

[0078] Optionally, when receiving a request message from the client, after determining the protocol type of the request message, the data transmission device based on the dual-entry protocol conversion platform also includes: a first allocation unit, which is used to use a load balancer to distribute traffic among each MQTT gateway according to the current traffic size of each MQTT gateway when the protocol type is the MQTT protocol, so as to send the request message to the corresponding MQTT gateway for processing; a second allocation unit, which is used to use a load balancer to distribute traffic among each TCP gateway according to the current traffic size of each TCP gateway when the protocol type is the TCP protocol, so as to send the request message to the corresponding TCP gateway for processing.

[0079] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein when the program is run, any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform is executed.

[0080] According to another aspect of an embodiment of the present invention, a computer program product is provided, including computer instructions, which, when executed by a processor, execute any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform.

[0081] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein the program executes any one of the above-mentioned data transmission methods based on a dual-entry protocol conversion platform.

[0082] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the communication devices in a communication device group.

[0083] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: when receiving a request message from a client, determining the protocol type of the request message and the receiving device type of the request message, wherein the receiving device type is the device type of the receiving device indicated by the request message; when the protocol type is the MQTT protocol and the receiving device type is a TCP device, converting the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and sending the TCP protocol message to the TCP device; when the protocol type is the TCP protocol and the receiving device type is the MQTT device, converting the request message into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and sending the MQTT protocol message to the MQTT device.

[0084] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: parsing the request message to obtain a first parsing result of the request message; determining the protocol type of the request message based on the first parsing result, and determining the receiving device type of the request message based on the first parsing result.

[0085] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: upon receiving a request message from a client, before determining the protocol type of the request message and the type of a receiving device of the request message, sending a TCP connection request to the client, wherein the TCP connection request is used to request establishment of a TCP connection with the client, and the TCP connection is used to perform data transmission with the client using the TCP protocol; upon receiving feedback information from the client, determining that the TCP connection with the client is successfully established.

[0086] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for executing the following steps: using a TCP gateway to parse the request message to obtain a second parsing result; extracting TCP data from the second parsing result; using a TCP gateway to convert the TCP data into an MQTT protocol message, wherein the MQTT protocol message includes: message subject, message content, and service quality level; sending the MQTT protocol message to an MQTT client, so as to use the MQTT client to send the MQTT protocol message to an MQTT agent, and sending the MQTT protocol to an MQTT device through the MQTT agent.

[0087] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: when receiving a first TCP response message from a TCP device, converting the first TCP response message into a first MQTT response message through an MQTT gateway; and publishing the first MQTT response message to a corresponding MQTT topic.

[0088] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: upon receiving a second MQTT response message from the MQTT device, converting the second MQTT response message into a second TCP response message through a TCP gateway; and sending the second TCP response message to a TCP client.

[0089] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: when receiving a request message from a client, after determining the protocol type of the request message, when the protocol type is the MQTT protocol, using a load balancer to distribute traffic among each MQTT gateway according to the current traffic size of each MQTT gateway, so as to send the request message to the corresponding MQTT gateway for processing; when the protocol type is the TCP protocol, using a load balancer to distribute traffic among each TCP gateway according to the current traffic size of each TCP gateway, so as to send the request message to the corresponding TCP gateway for processing.

[0090] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0091] In the above embodiments of the present invention, 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.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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 interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0093] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0094] In addition, each functional unit in each embodiment of the present invention 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.

[0095] 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 storage medium. Based on this understanding, the technical solution of the present invention, in essence, 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, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0096] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data transmission method based on a dual-entry protocol conversion platform, characterized in that: The dual-entry protocol conversion platform is used for protocol conversion between the lightweight communication protocol MQTT and the transmission control protocol TCP, including: Upon receiving a request message from a client, determining a protocol type of the request message and a receiving device type of the request message, wherein the receiving device type is a device type of the receiving device indicated by the request message; When the protocol type is the MQTT protocol and the receiving device type is a TCP device, the request message is converted into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and the TCP protocol message is sent to the TCP device; When the protocol type is the TCP protocol and the receiving device type is the MQTT device, the request message is converted into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device.

2. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: Determining the protocol type of the request message and the type of a receiving device of the request message includes: Parsing the request message to obtain a first parsing result of the request message; The protocol type of the request message is determined according to the first parsing result, and the receiving device type of the request message is determined according to the first parsing result.

3. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: When receiving a request message from a client, before determining the protocol type of the request message and the type of a receiving device of the request message, the method further includes: Sending a TCP connection request to a client, wherein the TCP connection request is used to request to establish a TCP connection with the client, and the TCP connection is used to perform TCP protocol data transmission with the client; When feedback information from the client is received, it is determined that the TCP connection with the client is successfully established.

4. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: When the protocol type is the TCP protocol and the receiving device type is an MQTT device, the request message is converted into an MQTT protocol message through a TCP gateway in the dual-entry protocol conversion platform, and the MQTT protocol message is sent to the MQTT device, including: Parsing the request message using the TCP gateway to obtain a second parsing result; Extracting TCP data from the second parsing result; The TCP gateway is used to convert the TCP data into the MQTT protocol message, wherein the MQTT protocol message includes: a message subject, a message content, and a service quality level; The MQTT protocol message is sent to the MQTT client, so that the MQTT client is used to send the MQTT protocol message to the MQTT agent, and the MQTT protocol is sent to the MQTT device through the MQTT agent.

5. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: Also includes: Upon receiving a first TCP response message from the TCP device, converting the first TCP response message into a first MQTT response message through the MQTT gateway; Publish the first MQTT response message to the corresponding MQTT topic.

6. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: Also includes: Upon receiving a second MQTT response message from the MQTT device, converting the second MQTT response message into a second TCP response message through the TCP gateway; The second TCP response message is sent to the TCP client.

7. The data transmission method based on the dual-entry protocol conversion platform according to claim 1 is characterized in that: When receiving a request message from a client, after determining the protocol type of the request message, the method further includes: When the protocol type is the MQTT protocol, a load balancer is used to distribute traffic among the MQTT gateways according to the current traffic size of each MQTT gateway, so as to send the request message to the corresponding MQTT gateway for processing; When the protocol type is the TCP protocol, the load balancer is used to distribute traffic among the TCP gateways according to the current traffic size of each TCP gateway, so as to send the request message to the corresponding TCP gateway for processing.

8. A data transmission device based on a dual-entry protocol conversion platform, characterized in that: The dual-entry protocol conversion platform is used for protocol conversion between the lightweight communication protocol MQTT and the transmission control protocol TCP, including: A first determination module is used to determine, when receiving a request message from a client, a protocol type of the request message and a receiving device type of the request message, wherein the receiving device type is a device type of the receiving device indicated by the request message; A first processing module is used for, when the protocol type is the MQTT protocol and the receiving device type is a TCP device, converting the request message into a TCP protocol message through the MQTT gateway in the dual-entry protocol conversion platform, and sending the TCP protocol message to the TCP device; The second processing module is used to convert the request message into an MQTT protocol message through the TCP gateway in the dual-entry protocol conversion platform when the protocol type is the TCP protocol and the receiving device type is the MQTT device, and send the MQTT protocol message to the MQTT device.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the data transmission method based on the dual-entry protocol conversion platform as described in any one of claims 1 to 7.

10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by the processor, the data transmission method based on the dual-entry protocol conversion platform described in any one of claims 1 to 7 is performed.