Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python mqtt subscribe code

def subscribe(client: mqtt_client):
    def on_message(client, userdata, msg):
        print(f"Received `{msg.payload.decode()}` from `{msg.topic}` topic")

    client.subscribe(topic)
    client.on_message = on_message
 
PREVIOUS NEXT
Tagged: #python #mqtt #subscribe #code
ADD COMMENT
Topic
Name
2+4 =