如果订阅者应用程序断开一段时间(例如崩溃),是否有可能得到所有丢失的事件?
我本来希望把干净的会话设置为真才能得到这种行为,但它不管用。这是我的代码:
import ibmiotf.application
options = {
"org": "org",
"id": "some-id",
"auth-method": "apikey",
"auth-key": "key",
"auth-token": "token",
"clean-session": False
}
client = ibmiotf.application.Client(options)
client.connect()
client.deviceEventCallback = eventCallback
client.subscribeToDeviceEvents(deviceType="deviceType")谢谢!
发布于 2017-11-22 10:10:56
您还需要使用QoS1或QoS2发布消息,并设置
client.subscribeToDeviceEvents(deviceType="deviceType",qos=1)
基本上,你需要做的是:
clean_session =False,
发布和订阅qos (服务质量)=1
这样,您发布的消息将在订阅服务器重新连接时接收。
有关沃森-物联网信息的所有细节都可以在这里找到。https://console.bluemix.net/docs/services/IoT/reference/mqtt/index.html#qos-levels
https://stackoverflow.com/questions/47431446
复制相似问题