O'Reilly logo

Hands-On MQTT Programming with Python by Gaston C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running multiple clients

Now, we will run the surfboard sensor emulator and the surfboard monitor we recently coded. Make sure you run these Python programs after you have followed the necessary steps to activate the virtual environment in which we have been working.

Execute the following line to start the surfboard sensor emulator example on any computer or device that you want to use as the MQTT client that works as the surfboard sensor emulator and uses Linux or macOS:

    python3 surfboard_sensors_emulator.py  

In Windows, you must execute the following line:

    python surfboard_sensors_emulator.py

After a few seconds, you will see the output shown in the next lines:

 Result from connect: Connection Accepted. surfboards/surfboard01/status: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required