WolkMQTT.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:WolkConnect-Python- 作者: Wolkabout 项目源码 文件源码
def _on_mqtt_connect(self, _, __, ___, result):
        if result:
            errorMessage = "Error connecting to mqtt broker: " + mqtt.connack_string(result)
            logger.error(errorMessage)
            raise WolkMQTTClientException(errorMessage)
        else:
            logger.info("Connected %s to mqtt broker", self.clientConfig.username)

        for topic in self.clientConfig.topics:
            (res, ____) = self.client.subscribe(topic, self.clientConfig.qos)
            if res == 0:
                logger.info("Subscribed to topic: %s", topic)
            else:
                logger.error("Failed subscribing to topic: %s reason: %s", topic, mqtt.error_string(res))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号