MQTT does not seem to easily lend itself to typical network debugging approaches. However, if you have privileges to listen to the network, you can use MQTTExplorer. The easiest way to install is via docker compose:

services:
  mqtt-explorer:
    container_name: mqtt-explorer
    image: smeagolworms4/mqtt-explorer
    restart: unless-stopped
    volumes:
      - ./config:/mqtt-explorer/config
    ports:
      - 4000:4000

Usage

Once the container is running, go to the web interface. You should be prompted to select or edit a connection. Add a new connection (use the ”+” button, top-left of the dialog) and set the following:

  • Name: doesn’t matter, whatever you want to call it
  • Protocol: mqtt://
  • Host: the hostname of the MQTT broker. Using the setup in Mosquitto, this would be mosquitto.
  • Port: the port of the MQTT broker. Typically 1883.
  • Username and Password: create a dedicated user for MQTT Explorer (see Adding a user) and enter the credentials here

Click Save, then Connect.