提交 92ce9133 编写于 作者: R Roger A. Light

Add note on different callback signatures.

上级 8a306a8f
...@@ -452,9 +452,14 @@ class Client(object): ...@@ -452,9 +452,14 @@ class Client(object):
client = paho.mqtt.Client() client = paho.mqtt.Client()
@client.connect_callback() @client.connect_callback()
def on_connect(client, userdata, flags, rc, properties=None): def on_connect(client, userdata, flags, rc):
print("Connection returned " + str(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" All of the callbacks as described below have a "client" and an "userdata"
argument. "client" is the Client instance that is calling the callback. 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 "userdata" is user data of any type and can be set when creating a new client
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册