From 5c77540e75d86e69a6cc78ada460f857345dd535 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Fri, 29 Mar 2024 05:22:17 +0100 Subject: [PATCH] Remedy breaking change with 2.x: Use CallbackAPIVersion.VERSION1 Use `callback_api_version = CallbackAPIVersion.VERSION1` as a default, to not unnecessarily cause downstream havocs. In this way, users can run their code with both versions of paho-mqtt 1.x and 2.x, which will significantly improve adoption rates. --- src/paho/mqtt/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 347d8ad2..754124bf 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -728,7 +728,7 @@ def on_connect(client, userdata, flags, reason_code, properties): def __init__( self, - callback_api_version: CallbackAPIVersion, + callback_api_version: CallbackAPIVersion = CallbackAPIVersion.VERSION1, client_id: str | None = "", clean_session: bool | None = None, userdata: Any = None,