如何修复mosquitto mid值?

时间:2015-06-27 15:08:28

标签: mosquitto

我使用mosquitto mqtt broker并对其消息id(mid)值有疑问如下。

我向测试频道发送消息,该频道的中间位置为“1234”,但PUBACK mid打印为另一个值

我想打印“1234”中间

我需要在蚊子来源中修改什么?

1435417408: Received PUBLISH from adventures (d0, q1, r0, m1234, 'test', ... (5 bytes)) 
1435417408: Sending PUBLISH to myclientid_49 (d0, q1, r0, m3, 'test', ... (5 bytes)) 
1435417408: Sending PUBLISH to myclientid_20 (d0, q1, r0, m2, 'test', ... (5 bytes)) 
1435417408: Sending PUBACK to adventures (Mid: 1234) 
1435417408: Received DISCONNECT from adventures 
1435417409: Received PUBACK from myclientid_49 (Mid: 3) 
1435417409: Received PUBACK from myclientid_20 (Mid: 2)

1 个答案:

答案 0 :(得分:1)

让我直接浏览你的经纪人日志。

此行是您从adventures客户端收到的已发布消息。你可以看到m1234表示消息ID是1234,就像你说的那样。

1435417408: Received PUBLISH from adventures (d0, q1, r0, m1234, 'test', ... (5 bytes))

这两行显示正在发送给订阅test主题的两个客户端的消息。他们分别有邮件ID 32。请注意,消息ID是针对不同的客户端和消息方向单独处理的。

1435417408: Sending PUBLISH to myclientid_49 (d0, q1, r0, m3, 'test', ... (5 bytes)) 
1435417408: Sending PUBLISH to myclientid_20 (d0, q1, r0, m2, 'test', ... (5 bytes)) 

这是将PUBACK发送回原始客户端的代理。您将再次看到消息ID为1234。

1435417408: Sending PUBACK to adventures (Mid: 1234)

这是来自原始客户端的断开连接消息。

1435417408: Received DISCONNECT from adventures

这是订阅客户将PUBACK发送回经纪人,从上方重复中间32

1435417409: Received PUBACK from myclientid_49 (Mid: 3) 
1435417409: Received PUBACK from myclientid_20 (Mid: 2)

总之,我认为这一切都有道理。