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: ...

Get Hands-On MQTT Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.