Testing The Broker From Ubuntu

A project log for Lazy MQTT Broker and Client

A free hosted MQTT broker and a Javascript Websocket client

LazyHDLazyHD 09/25/2016 at 17:430 Comments

Below are some steps for testing the hosted broker using your local Ubuntu machine.

From your terminal execute the following commands:

  1. Install mosquitto client tools
    sudo apt-get install mosquitto-client
  2. Subscribe to a desired topic e.g "lazy/engineers". Notice your terminal is waiting for an incoming message.
    mosquitto_sub -h -p 1883 -v -t "lazy/engineers" -u lazyengineers -P lazyengineers
  3. Open another terminal window to publish to the same topic
    mosquitto_pub -h -p 1883 -t "lazy/engineers" -u lazyengineers -P lazyengineers -m "Lazy Engineers Are Awesome - Sent From Console"
  4. On the first terminal where you are subscribed and it was waiting you should now see the message
    lazy/engineers Lazy Engineers Are Awesome - Sent From Console
  5. You can also mix the publish subscribe using the terminal and the html client on the following link.
    You can publish from the terminal, subscribe and receive the messages on the HTML client and vise versa.