paho.py 文件源码

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

项目:kotori 作者: daq-tools 项目源码 文件源码
def connect_with_retry(self):
        try:
            self.client.connect(self.broker_host, port=self.broker_port, keepalive=60)
            self.connect_loop.stop()
        except:
            log.failure(u'Error connecting to MQTT broker but retrying each {retry_interval} seconds',
                retry_interval=self.retry_interval)
            return

        """
        This is part of the threaded client interface. Call this once to
        start a new thread to process network traffic. This provides an
        alternative to repeatedly calling loop() yourself.
        """
        # TODO: Check whether reconnect works with this interface.
        self.client.loop_start()
        reactor.addSystemEventTrigger('before', 'shutdown', self.client.loop_stop, True)

    # The callback for when the client receives a CONNACK response from the server.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号