Basically, the MQTT protocol defines two types of network entities: a message broker and a number of clients.
An MQTT broker is a server that receives all messages from the clients and then routes the messages to the appropriate destination clients.
An MQTT client is any device (from a micro controller up to a full-fledged server) that runs an MQTT library and connects to an MQTT broker over a network.
MQTT is a lightweight and flexible network protocol designed to achieve the right balance for IoT developers.
The MQTT Client library is implemented in many languages, including Embedded C, C, Java, JavaScript, Python, C++, C#, Go, iOS, Android, and so on.
Download address of the MQTT library for Eclipse Paho:
Connecting to the Alibaba Cloud IoT Platform
Establish MQTT connections over TCP:
Alibaba Cloud Official documentation link:
Now, you can use the documentation provided by the device manufacturer and use the app postman to test Rest API.
I am installing Chrome App, following is the link:
Or alternatively, you can also use the full software from the following link:
Now, in the postman app as per the documentation of the device, I am providing the URL:
Following is the screenshot of Chrome App Postman
Now, you can use any MQTT Client, like THE PAHO-eclipse client, but I will be using MQTT.fx
You can download it from: https://mqttfx.jensd.de/
Then, you will need to provide the MQTT broker profile settings, which includes Broker Address, Port and Client Id. You will also need to provide the User Credentials, that is username and password.
then you can connect the server online and if everything goes well then it will connect successfully.
Now, you have to provide topic as per the documentation of the device.
Here is the documentation of the device that I am using:
https://d.test.dudubox.cn/sw/web/docs/aliyuniot.html
the above link is in chinese, following is the translated version:
It shows that the client needs to subscribe to the topic:
/$productKey/$deviceName/get
and to post topic:
/$productKey/$deviceName/update
So, I inputted the following topic:
a1HxxxxxxZZy/352000000001431/get
and the connection was successful.
I hope this helps!
Comments
Post a Comment