下面是我的paho客户端连接
var client = new Paho.MQTT.Client(Constants.MQTT_HOST, Number(Constants.MQTT_PORT), Constants.MQTT_CLIENT_ID);
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
client.onMessageDelivered = onMessageDelivered;
client.connect({onSuccess:onConnect});当我使用
var message = new Paho.MQTT.Message(Utils.uintToString(enc));
message.destinationName = targetTopicName;
client.send(message); 为了发送消息,onMessageDelivered和onMessageArrived都会被调用。
发布于 2016-03-17 03:38:12
您是订阅了同一主题,还是使用了包含该主题的通配符(例如#)?
如果是这样的话,onMessageDelivered和onMessage都会被调用。如果你没有订阅,那么这听起来像是一个错误,你可以在这里提出:https://github.com/eclipse/paho.mqtt.javascript/issues
https://stackoverflow.com/questions/36043283
复制相似问题