Skip to content

Python Snake tutorial Step 4 does not show MQTT "Connected" #96

Description

@Soccertanker

Step 4 of the Python Snake MQTT tutorial says to run python code to connect to 'mqtt.ably.io' mqtt broker.

The code

client.loop_start()
   client.connect('mqtt.ably.io', port=8883, keepalive=15)

should trigger the stdout message 'Connected' because the on connect callback prints 'Connected':

def on_connect(client, userdata, flags, rc):
  print('Connected')

But on my system, no 'Connected' message is printed before the python script terminates. I added a time.sleep(5) after client.connect(...) to delay script termination, and 'Connected' now prints, as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions