How to test the `Mosquitto` server?

user2121 picture user2121 · Nov 3, 2014 · Viewed 168.7k times · Source

I am new to Mosquitto and MQTT, I downloaded the Mosquitto server library but I do not know how to test it.

Is there any way to test the Mosquitto server?

Answer

hardillb picture hardillb · Nov 3, 2014

In separate terminal windows do the following:

  1. Start the broker:

    mosquitto
    
  2. Start the command line subscriber:

    mosquitto_sub -v -t 'test/topic'
    
  3. Publish test message with the command line publisher:

    mosquitto_pub -t 'test/topic' -m 'helloWorld'
    

As well as seeing both the subscriber and publisher connection messages in the broker terminal the following should be printed in the subscriber terminal:

test/topic helloWorld