我正在运行真正的小型消息代理(RSMB)1.3.0.2,支持MQTT-SN。我有一个Arduino客户端通过MQTT-SN协议与它通信。
Arduino是睡眠客户端 - 电池供电的设备。 以下是它的工作原理:
问题是代理不会确认步骤5中发送的消息。 Arduino试图重发该消息几次,然后放弃了。
我的理解是,在使用cleansession 0重新连接之后,所有以前的订阅都是有效的,并且还有主题名称映射的topicID。
以下是我的评论RSBM日志:
Client connects
20150227 152211.587 132 127.0.0.1:55701 <- MQTT-S CONNECT cleansession: 0
20150227 152211.587 1998536376 127.0.0.1:55701 XinoRf_1 -> MQTT-S CONNACK returncode 0 (0)
20150227 152211.588 CWNAN0000I Client connected to udp port 1885 from XinoRf_1 (127.0.0.1:55701)
Here start 1st topic registration and acknowledgment - its id is 1
20150227 152211.678 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S REGISTER msgid: 1 topicid: 0 topicname: net/mf/ha/
20150227 152211.678 132 127.0.0.1:55701 XinoRf_1 -> MQTT-S REGACK msgid: 1 topicid: 1 returncode: 0 (0)
Here starts send and acknowledge of a 1st message in topic 1
20150227 152211.753 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 2 qos: 1 retained: 0
20150227 152211.753 1998536376 127.0.0.1:55701 XinoRf_1 -> MQTT-S PUBACK msgid: 2 (0)
Here start 2nd topic registration and acknowledgment - its id is 2
20150227 152211.753 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S REGISTER msgid: 3 topicid: 0 topicname: net/mf/ha/
20150227 152211.846 132 127.0.0.1:55701 XinoRf_1 -> MQTT-S REGACK msgid: 3 topicid: 2 returncode: 0 (0)
Here starts send and acknowledge of a 1st message in topic 2
20150227 152211.921 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 4 qos: 1 retained: 0
20150227 152211.921 1998536376 127.0.0.1:55701 XinoRf_1 -> MQTT-S PUBACK msgid: 4 (0)
Here start 3rd topic registration and acknowledgment - its id is 3
20150227 152212.005 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S REGISTER msgid: 5 topicid: 0 topicname: net/mf/ha/
20150227 152212.005 132 127.0.0.1:55701 XinoRf_1 -> MQTT-S REGACK msgid: 5 topicid: 3 returncode: 0 (0)
Here starts send and acknowledge of a 1st message in topic 3
20150227 152212.080 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 6 qos: 1 retained: 0
20150227 152212.080 1998536376 127.0.0.1:55701 XinoRf_1 -> MQTT-S PUBACK msgid: 6 (0)
Here Arduino sends disconnect request with duration 4000 (it does not matter what value is sent here, behaviour is same)
20150227 152212.080 1998536376 127.0.0.1:55701 XinoRf_1 <- MQTT-S DISCONNECT duration: 4000
20150227 152212.461 CWNAN0038I Disconnection request received from client XinoRf_1
20150227 152212.461 132 127.0.0.1:55701 XinoRf_1 -> MQTT-S DISCONNECT duration: 0 (0)
At this point Arduino sleeps appprox. 4 seconds
Arduino reconnects with clean session 0 - I believe all previous registrations should be kept by the broker
20150227 152217.519 132 127.0.0.1:55701 <- MQTT-S CONNECT cleansession: 0
20150227 152217.519 1998536376 127.0.0.1:55701 XinoRf_1 -> MQTT-S CONNACK returncode 0 (0)
20150227 152217.519 CWNAN0000I Client connected to udp port 1885 from XinoRf_1 (127.0.0.1:55701)
At this point Arduino is connecte
Here starts send a 2nd message in topic 1 - message never gets acknowledged by the broker.
20150227 152217.603 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
Following messages are resent by the client
20150227 152232.595 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
20150227 152247.575 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
20150227 152301.577 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
20150227 152317.536 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
20150227 152332.516 132 127.0.0.1:55701 XinoRf_1 <- MQTT-S PUBLISH msgid: 7 qos: 1 retained: 0
随后我发现在eclipse.org(现在正在维护RSMB)上报告的bug很少,这是造成这种行为的原因:
答案 0 :(得分:1)
上有固定的RSMB版本