comparison lib/mqtt_client/mqtt_client.py @ 1363:3cf19717cb6f

also pass topic as str at publish Ignore-this: ae4519416b4c4a29db44e9569b60edd darcs-hash:4c19d5e698fe888fbf580c9fa4101564056ddeda
author drewp <drewp@bigasterisk.com>
date Wed, 01 May 2019 00:09:23 -0700
parents e121dc5c09df
children f883166f7ca1
comparison
equal deleted inserted replaced
1362:8642ed427607 1363:3cf19717cb6f
45 def publish(self, topic: bytes, msg: bytes): 45 def publish(self, topic: bytes, msg: bytes):
46 def _logFailure(failure): 46 def _logFailure(failure):
47 log.warn("publish failed: %s", failure.getErrorMessage()) 47 log.warn("publish failed: %s", failure.getErrorMessage())
48 return failure 48 return failure
49 49
50 return self.protocol.publish(topic=bytearray(topic), qos=0, 50 return self.protocol.publish(topic=topic.decode('utf-8'), qos=0,
51 message=bytearray(msg)).addErrback(_logFailure) 51 message=bytearray(msg)).addErrback(_logFailure)
52 52
53 53
54 class MqttClient(object): 54 class MqttClient(object):
55 def __init__(self, brokerHost='bang', brokerPort=1883): 55 def __init__(self, brokerHost='bang', brokerPort=1883):