I tried the Introduction to MQTT tutorial on my R Pi 3B and Windows 10 PC. If the client and publisher were both on the R Pi, the output was as follows
root@raspberrypi:~# cd Documents
root@raspberrypi:~/Documents# python mqtt_client_demo.py
Connected with result code 0
CoreElectronics/test []
CoreElectronics/topic World!
Received message 2, do something else
Now start publisher
CoreElectronics/test Hello
Received message 1, do something
CoreElectronics/topic World!
Received message 2, do something else
If the client was on the Windows 10 PC the output was as follows
Windows PowerShell
Copyright © Microsoft Corporation. All rights reserved.
PS C:\Users\Acer Desktop PC> cd Desktop
PS C:\Users\Acer Desktop PC\Desktop> python mqtt_client_demo.py
Connected with result code 0
CoreElectronics/test b’[]’
CoreElectronics/topic b’World!’
Now start publisher
CoreElectronics/test b’Hello’
CoreElectronics/topic b’World!’
The R Pi and PC are clearly communicating, but I am puzzled why the PC does not display the received messages. There are some other differences between what I got and the MQTT tutorial. I am studying MQTT for a project on Internet of Things which I may discuss at a later date.