diff --git a/lib/client.js b/lib/client.js index 08fc443a1..36f47ef28 100644 --- a/lib/client.js +++ b/lib/client.js @@ -373,9 +373,9 @@ MqttClient.prototype._setupStream = function () { // auth if (this.options.properties) { if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) { - that.end(() => - this.emit('error', new Error('Packet has no Authentication Method') - )) + that.end(function () { + this.emit('error', new Error('Packet has no Authentication Method')) + }) return this } if (this.options.properties.authenticationMethod && this.options.authPacket && typeof this.options.authPacket === 'object') { @@ -837,7 +837,7 @@ MqttClient.prototype.end = function (force, opts, cb) { // just to make sure things are // ok for websockets debug('end :: (%s) :: finish :: calling _cleanUp with force %s', that.options.clientId, force) - that._cleanUp(force, () => { + that._cleanUp(force, function () { debug('end :: finish :: calling process.nextTick on closeStores') // var boundProcess = nextTick.bind(null, closeStores) nextTick(closeStores.bind(that))