From Clomosy Docs

(Created page with ":'''<span style="color:blue">What is MQTT?</span>''' Message queuing telemetry support (MQTT) is defined as a low bandwidth consumption machine-to-machine protocol that helps IoT devices communicate with each other, with minimal code requirements and network footprint.<br> <gallery widths="500px" heights="350px" mode="packed-hover"> File: MQTTProcess.png | ''Demonstration of MQTT Process'' </gallery> :'''<span style="color:blue">How Does MQTT Work?</span>''' MQTT’...")
 
No edit summary
Line 14: Line 14:


Now that we have learned this information, we can use it remotely by connecting to our device with this system created in our infrastructure using the TclMQTT component.<br>
Now that we have learned this information, we can use it remotely by connecting to our device with this system created in our infrastructure using the TclMQTT component.<br>
The first step required for this process on Clomosy is to define the TclMqtt variable. This variable must then be created on the form.
'''var'''
  MyMQTT : TclMQTT;
'''begin'''
  MyMQTT := MyForm.AddNewMQTTConnection(bigPanel,'MyMQTT');
'''end;'''
:<span style="color:blue">'''tbeOnMQTTStatusChanged:'''</span>
This is an event that occurs when the state of the MQTT connection changes. When an event change occurs, the event written in the 3rd parameter is triggered.
MyForm.AddNewEvent(MyMQTT,tbeOnMQTTStatusChanged,'MyMQTTStatusChanged');
:<span style="color:blue">'''tbeOnMQTTPublishReceived:'''</span>
This is an event that occurs when an MQTT message is received. The event in the 3rd parameter is used to process the received message.
MyForm.AddNewEvent(MyMQTT,tbeOnMQTTPublishReceived,'MyMQTTPublishReceived');
:<span style="color:blue">'''ReceivedAlright:'''</span>
It returns true if there is an oncoming return on the network, otherwise it returns false.
MyMQTT.ReceivedAlright
:<span style="color:blue">'''ReceivedMessage:'''</span>
It is used to access messages coming from the network.
MyMQTT.ReceivedMessage
:<span style="color:blue">'''ReceivedTopic:'''</span>
It is a feature that returns the network path of the channel when a message arrives on the network.
MyMQTT.ReceivedTopic

Revision as of 09:00, 2 October 2023

What is MQTT?

Message queuing telemetry support (MQTT) is defined as a low bandwidth consumption machine-to-machine protocol that helps IoT devices communicate with each other, with minimal code requirements and network footprint.

How Does MQTT Work?

MQTT’s publish/subscribe (pub/sub) communication strategy, which aims to maximize bandwidth utilization, is a substitute for traditional consumer architecture directly interacting with an endpoint. However, in the pub/sub paradigm, the client who transmits the news (the publisher) is separated from the customers receiving the information (or the subscribers). Since neither the writers nor the customers communicate with each other immediately, their interactions in them are handled by third parties called brokers.

Publishers and subscribers are two types of MQTT clients, depending on whether the client is publishing or getting messages. One can combine the two features in a single MQTT client. A publish is when a device (or client) wishes to send information to the server (or broker). In the middle, there is a central server or broker that acts as a mediator. Each incoming message is filtered by the broker, who then sends them to the appropriate customers. (clomosy)

Now that we have learned this information, we can use it remotely by connecting to our device with this system created in our infrastructure using the TclMQTT component.

The first step required for this process on Clomosy is to define the TclMqtt variable. This variable must then be created on the form.

var
 MyMQTT : TclMQTT;
begin
 MyMQTT := MyForm.AddNewMQTTConnection(bigPanel,'MyMQTT');
end;
tbeOnMQTTStatusChanged:

This is an event that occurs when the state of the MQTT connection changes. When an event change occurs, the event written in the 3rd parameter is triggered.

MyForm.AddNewEvent(MyMQTT,tbeOnMQTTStatusChanged,'MyMQTTStatusChanged');
tbeOnMQTTPublishReceived:

This is an event that occurs when an MQTT message is received. The event in the 3rd parameter is used to process the received message.

MyForm.AddNewEvent(MyMQTT,tbeOnMQTTPublishReceived,'MyMQTTPublishReceived');
ReceivedAlright:

It returns true if there is an oncoming return on the network, otherwise it returns false.

MyMQTT.ReceivedAlright
ReceivedMessage:

It is used to access messages coming from the network.

MyMQTT.ReceivedMessage
ReceivedTopic:

It is a feature that returns the network path of the channel when a message arrives on the network.

MyMQTT.ReceivedTopic