Comparing version 5.0.0-beta.1 to 5.0.0-beta.2
@@ -20,6 +20,7 @@ 'use strict' | ||
const nextTick = process ? process.nextTick : function (callback) { setTimeout(callback, 0) } | ||
const setImmediate = global.setImmediate || function (callback) { | ||
// works in node v0.8 | ||
nextTick(callback) | ||
const setImmediate = global.setImmediate || function (...args) { | ||
const callback = args.shift() | ||
nextTick(callback.bind(null, ...args)) | ||
} | ||
const defaultConnectOptions = { | ||
@@ -33,3 +34,4 @@ keepalive: 60, | ||
clean: true, | ||
resubscribe: true | ||
resubscribe: true, | ||
writeCache: true | ||
} | ||
@@ -283,2 +285,7 @@ | ||
// Disable pre-generated write cache if requested. Will allocate buffers on-the-fly instead. WARNING: This can affect write performance | ||
if (!this.options.writeCache) { | ||
mqttPacket.writeToStream.cacheNumbers = false | ||
} | ||
this.streamBuilder = streamBuilder | ||
@@ -747,3 +754,3 @@ | ||
that._resubscribeTopics[topic].qos < opts.qos || | ||
resubscribe) { | ||
resubscribe) { | ||
const currentOpts = { | ||
@@ -770,3 +777,3 @@ topic: topic, | ||
that._resubscribeTopics[k].qos < obj[k].qos || | ||
resubscribe) { | ||
resubscribe) { | ||
const currentOpts = { | ||
@@ -1265,3 +1272,3 @@ topic: k, | ||
case 0: | ||
/* falls through */ | ||
/* falls through */ | ||
default: | ||
@@ -1625,3 +1632,3 @@ sendPacket(this, packet, cb) | ||
case 'pubcomp': | ||
// same thing as puback for QoS 2 | ||
// same thing as puback for QoS 2 | ||
case 'puback': { | ||
@@ -1672,2 +1679,3 @@ const pubackRC = packet.reasonCode | ||
} | ||
delete this.messageIdToTopic[messageId] | ||
this._invokeStoreProcessingQueue() | ||
@@ -1689,3 +1697,3 @@ cb(null, packet) | ||
if (this.disconnecting && | ||
Object.keys(this.outgoing).length === 0) { | ||
Object.keys(this.outgoing).length === 0) { | ||
this.emit('outgoingEmpty') | ||
@@ -1759,4 +1767,4 @@ } | ||
if (!this._firstConnection && | ||
(this.options.clean || (this.options.protocolVersion === 5 && !this.connackPacket.sessionPresent)) && | ||
_resubscribeTopicsKeys.length > 0) { | ||
(this.options.clean || (this.options.protocolVersion === 5 && !this.connackPacket.sessionPresent)) && | ||
_resubscribeTopicsKeys.length > 0) { | ||
if (this.options.resubscribe) { | ||
@@ -1763,0 +1771,0 @@ if (this.options.protocolVersion === 5) { |
{ | ||
"name": "mqtt", | ||
"description": "A library for the MQTT protocol", | ||
"version": "5.0.0-beta.1", | ||
"version": "5.0.0-beta.2", | ||
"contributors": [ | ||
@@ -52,5 +52,2 @@ "Adam Rudd <adamvrr@gmail.com>", | ||
"npm run test" | ||
], | ||
"after:bump": [ | ||
"npm run changelog" | ||
] | ||
@@ -130,2 +127,3 @@ }, | ||
"mqtt-connection": "^4.0.0", | ||
"mqtt-level-store": "^3.1.0", | ||
"nyc": "^15.0.1", | ||
@@ -141,4 +139,3 @@ "pre-commit": "^1.2.2", | ||
"terser": "^5.14.2", | ||
"typescript": "^4.5.5", | ||
"mqtt-level-store": "^3.1.0" | ||
"typescript": "^4.5.5" | ||
}, | ||
@@ -145,0 +142,0 @@ "standard": { |
@@ -138,4 +138,4 @@ # ![mqtt.js](https://raw.githubusercontent.com/mqttjs/MQTT.js/137ee0e3940c1f01049a30248c70f24dc6e6f829/MQTT.js.png) | ||
```js | ||
const mqtt = require("mqtt"); // require mqtt | ||
const client = mqtt.connect("est.mosquitto.org"); // create a client | ||
const mqtt = require("mqtt") // require mqtt | ||
const client = mqtt.connect("test.mosquitto.org") // create a client | ||
``` | ||
@@ -142,0 +142,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1169630
26824