标签:rev his flag data 对象 事件 _for 提示 sub
Paho 客户端的 python 实现:
https://pypi.org/project/paho-mqtt/
进入 client 的事件循环之后,Paho client 内部将会自动处理掉线重连。但是重连后的状态变化,重连的重试次数等,需要小心处理。
以下几个参数与函数接口需要特别留意。
It automatically handles reconnecting.
a boolean that determines the client type. If True, the broker will remove all information about this client when it disconnects. If False, the client is a durable client and subscription information and queued messages will be retained when the client disconnects.Note that a client will never discard its own outgoing messages on disconnect. Calling connect() or reconnect() will cause the messages to be resent. Use reinitialise() to reset a client to its original state.
The client will automatically retry connection. Between each attempt it will wait a number of seconds between min_delay and max_delay.
When the connection is lost, initially the reconnection attempt is delayed of min_delay seconds. It’s doubled between subsequent attempt up to max_delay.
using clean session set to 0 only. If a client with clean session=0, that reconnects to a broker that it has previously connected to, this flag indicates whether the broker still has the session information for the client. If 1, the session still exists.
标签:rev his flag data 对象 事件 _for 提示 sub
原文地址:https://www.cnblogs.com/liaojieliang/p/mqtt-paho-reconnect.html