To publish a message you should try like this:
mosquitto_pub -h localhost -t YourTopic -m "Your message"
Now if you want to see that message you should try like this:
mosquitto_sub -h localhost -t YourTopic
Please note in some circumstances you cannot see a published message:
- Your broker is not installed properly
- Your broker is installed on a device, and also your subscriber and publisher devices are different devices. In that case you should make sure all the devices are connected to the same network and all of them can listen each other without firewall interfering (try pinging all devices from each other).