Closed wlhappy01 closed 5 years ago
可以通过网关publish willmessage,里面的WillRetain的是是否保留遗嘱消息(也就是订阅相关的topic,发送相关的离线消息),QOS=0 是 清除基于topic 的遗嘱消息,QOS>0是保留以前的遗嘱消息,并且添加到遗嘱消息列表中,然后设备订阅topic后,会send 遗嘱消息,具体操作看下图
感谢! 1.首先测试发现Qos仅仅能设置为0,设置为1或2则返回 { "IsSucceed": false, "Message": "Exception of type 'DotNetty.Codecs.EncoderException' was thrown.|InnerException:Object reference not set to an instance of an object.", "StatusCode": 400 }
2.其次,如果Client处于连接状态是可以收到的;但在WillRetain=true的情况下,客户端离线后发布Topic信息,客户端再次连接还是不能接受到离线之前的消息 {"deviceId":"",
"message":{ "Topic":"/T", "Message":"fff", "Qos":0, "WillRetain":true } } 3.使用MQnetclient客户端测试,将发布消息的retain设置为true,发布消息Surging服务端出错 public MqttApplicationMessage(string topic, byte[] payload, MqttQualityOfServiceLevel qualityOfServiceLevel, bool retain); var appMsg = new MqttApplicationMessage(topic, Encoding.UTF8.GetBytes(inputString), MqttQualityOfServiceLevel.AtMostOnce, true);
以上,辛苦了~!感谢
我先看下,如果感兴趣,可以fix bug
WillRetain=True 可以收到你再试试,Qos>0报错我再看看
WillRetain=True 可以收到你再试试,Qos>0报错我再看看
我测试还是不能收到离线消息,不知是不是我的流程不对 我的流程是 1.客户端先连接broker,然后publish发送一次消息,此时客户端能接受到消息 2.退出客户端,再publish发送一条消息 3.客户端再用同样的userid和topic连接broker,看是否收到消息,结果未收到
为了不影响他人,你的issues 会进行close ,你的其它的问题,会进行检查,谢谢!
请问使用Surging MQTT协议做离线消息推送是否可行?