0
votes

I downloaded the Mosquitto broker and trying to implement MQTT protocol using Arduino UNO + Ethernet shield as client and Mosquitto on a desktop. As soon as I run the .exe file of the broker named "mosquitto", a Command line prompt pops up, and stays just like that with no lines! Does this happen as such or should it be displaying some message?

Also, the pub and sub files of the Mosquitto (.exe) when run, open a command propmpt and immediately close! They don't stay stagnant at all! I am using Arduino UNO with Ethernet shield to publish data but then the broker is what creates the above mentioned problem.

1
Possible duplicate of How to test the `Mosquitto` server?hardillb

1 Answers

0
votes

The mosquitto broker and the mosquitto_pub & mosquitto_sub commands are not GUI applications.

The mosquitto broker command on windows when run by double clicking on it will just open a terminal and wait for connections, this is working properly.

The mosquitto_pub and mosquitto_sub commands need to be run from a command prompt, not by just clicking on them. This is because they require command line arguments in order to do anything useful.

Basically to publish something with mosquitto_pub you need to supply a message to send

mosquitto_pub -t some/topic -m "message payload"

To subsribe you need to supply the topic to listen on:

mosquitto_sub -v -t some/topic 

Please read the following answer for more details: How to test the `Mosquitto` server?