MQTT is a lightweight, publish-subscribe, machine-to-machine network protocol. It uses Publisher/Subscriber pattern and translates the messages between devices, servers, and applications. The MQTT protocol was initially created to link sensors like pipelines that communicate with satellites, emphasizing minimal battery loss and bandwidth consumption.
Open cooja simulator
In terminal cd contiki-ng/tools/cooja >> ant run
Create new simulation
Create motes for simulation
Choose the following location and create motes 1.contiki-ng/examples/rpl-border-router/border-router.c //For border router 2.contiki-ng/examples/mqtt-client/mqtt-client.c //For Publisher 3.contiki-ng/examples/mqtt-client/mqtt-client.c //For Subscriber
connect border-router and broker/server
Open a new terminal to connect a border_router. 1.cd contiki-ng/examples/rpl-border-router >>make TARGET=(platform) connect-router-cooja
Open another terminal to connect a broker. 2.mosquitto -p port address
Open cooja simulator
Run Simulation