diff --git a/lib/client.js b/lib/client.js index a68bdbb..39822e6 100644 --- a/lib/client.js +++ b/lib/client.js @@ -535,26 +535,28 @@ Client.prototype.handleAuthorizePublish = function(err, success, packet) { packet.payload = success; } - var dopuback = function() { - // if qos2Puback, then if qos 2, don't just ignore the message, puback it - // by converting internally to qos 1. - // this fools mqtt.js into not holding all messages forever - if (packet.qos === 2){ - switch(that.server.onQoS2publish){ - case 'dropToQoS1': - packet.qos = 1; - break; - case 'disconnect': - if (!this._closed && !this._closing) { - that.close(null, "qos2 caused disconnect"); - } - return; - break; - default: - break; - } + // Mosca does not support QoS2 + // if onQoS2publish === 'dropToQoS1', don't just ignore QoS2 message, puback it + // by converting internally to qos 1. + // this fools mqtt.js into not holding all messages forever + // if onQoS2publish === 'disconnect', then break the client connection if QoS2 + if (packet.qos === 2){ + switch(that.server.onQoS2publish){ + case 'dropToQoS1': + packet.qos = 1; + break; + case 'disconnect': + if (!this._closed && !this._closing) { + that.close(null, "qos2 caused disconnect"); + } + return; + break; + default: + break; } + } + var dopuback = function() { if (packet.qos === 1 && !(that._closed || that._closing)) { that.connection.puback({ messageId: packet.messageId