From 92ce91331cb9ccd401ccd41619efe02c80b3451e Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 29 Jul 2021 17:54:22 +0100 Subject: [PATCH] Add note on different callback signatures. --- src/paho/mqtt/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 63ad955..6a2317d 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -452,9 +452,14 @@ class Client(object): client = paho.mqtt.Client() @client.connect_callback() - def on_connect(client, userdata, flags, rc, properties=None): + def on_connect(client, userdata, flags, rc): print("Connection returned " + str(rc)) + + **IMPORTANT** the required function signature for a callback can differ + depending on whether you are using MQTT v5 or MQTT v3.1.1/v3.1. See the + documentation for each callback. + All of the callbacks as described below have a "client" and an "userdata" argument. "client" is the Client instance that is calling the callback. "userdata" is user data of any type and can be set when creating a new client -- GitLab