MQTT | Push data to Device
Last updated
Last updated
Prerequisites
Have MQTT FX software. If you don't have it, please go to the following link MQTT FX.
Login to your Antares account via Antares Console https://console.antares.id
Save Access Keys, you can view Access Keys on the API Keys page
Create an App, if you already have one, ignore it to proceed to the next process.
Create Device, if you already have one, ignore it to proceed to the next process.
Open the MQTT FX software. The user interface is shown in the following figure.
Firstly, you need to configure so that you can connect with our MQTT Broker. The configuration is shown below.
When you successfully connect, a green icon will appear on the top right.
Click Subscribe, then run subscribe a topic by following this format:
/oneM2M/resp/antares-cse/your-access-key/choose-a-serialization-format
The choose-a-serialisation-format parameter can have 2 values:xml
untuk format XML
json
for JSON format
In this step, it means that you will get a message/notification when a change happens to your account. In this tutorial, we use MQTT FX tools to subscribe, but in the real case scenario, it will be the device that subscribes to the topic.
This step, we will emulate requests coming from mobile apps. It also uses MQTT FX as a tool. Start publishing to the following topics:
/oneM2M/req/your-access-key/antares-cse/choose-a-serialization-format
The choose-a-serialization-format
parameter can have 2 values:
xml
for XML format
json
for JSON format
Example:
Topic: /oneM2M/req/your-access-key/antares-cse/json
Contents
All data in "con" is defined by yourself. You can create your own format data.
Congratulations! You have just received your first request using the MQTT API.