Update paho-mqtt==1.6.1

This commit is contained in:
JonnyWong16 2021-11-28 13:49:48 -08:00
commit 966a6696d1
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
9 changed files with 680 additions and 502 deletions

View file

@ -1,7 +1,7 @@
# Copyright (c) 2016 Roger Light <roger@atchoo.org>
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# are made available under the terms of the Eclipse Public License v2.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#
# The Eclipse Public License is available at
@ -20,10 +20,11 @@ you to pass a callback for processing of messages.
"""
from __future__ import absolute_import
from . import client as paho
from .. import mqtt
from . import client as paho
def _on_connect(client, userdata, flags, rc):
def _on_connect_v5(client, userdata, flags, rc, properties):
"""Internal callback"""
if rc != 0:
raise mqtt.MQTTException(paho.connack_string(rc))
@ -34,6 +35,10 @@ def _on_connect(client, userdata, flags, rc):
else:
client.subscribe(userdata['topics'], userdata['qos'])
def _on_connect(client, userdata, flags, rc):
"""Internal v5 callback"""
_on_connect_v5(client, userdata, flags, rc, None)
def _on_message_callback(client, userdata, message):
"""Internal callback"""
@ -142,7 +147,10 @@ def callback(callback, topics, qos=0, userdata=None, hostname="localhost",
protocol=protocol, transport=transport,
clean_session=clean_session)
client.on_message = _on_message_callback
client.on_connect = _on_connect
if protocol == mqtt.client.MQTTv5:
client.on_connect = _on_connect_v5
else:
client.on_connect = _on_connect
if proxy_args is not None:
client.proxy_set(**proxy_args)