In synchronous mode, the first connection attempt must succeed or an exception will be raised. Best for (semi-)interactive applications. In asynchronous mode, will try to connect indefinitely.
Run the publisher and subscriber using python3 publisher.py and python3 subscriber.py respectively. Before the code will actually work, you'll have to go through a broker. To get started, choose a ...