mqtt-packet
Advanced tools
Comparing version 6.8.1 to 6.9.0
@@ -174,2 +174,4 @@ /* Protocol - protocol constants */ | ||
protocol.VERSION5 = Buffer.from([5]) | ||
protocol.VERSION131 = Buffer.from([131]) | ||
protocol.VERSION132 = Buffer.from([132]) | ||
@@ -176,0 +178,0 @@ /* QoS */ |
{ | ||
"name": "mqtt-packet", | ||
"version": "6.8.1", | ||
"version": "6.9.0", | ||
"description": "Parse and generate MQTT packets like a breeze", | ||
@@ -5,0 +5,0 @@ "main": "mqtt.js", |
@@ -161,2 +161,7 @@ const bl = require('bl') | ||
if (packet.protocolVersion >= 128) { | ||
packet.bridgeMode = true | ||
packet.protocolVersion = packet.protocolVersion - 128 | ||
} | ||
if (packet.protocolVersion !== 3 && packet.protocolVersion !== 4 && packet.protocolVersion !== 5) { | ||
@@ -341,2 +346,6 @@ return this._emitError(new Error('Invalid protocol version')) | ||
subscription.rh = rh | ||
} else if (this.settings.bridgeMode) { | ||
subscription.rh = 0 | ||
subscription.rap = true | ||
subscription.nl = true | ||
} | ||
@@ -343,0 +352,0 @@ |
@@ -86,3 +86,3 @@ const protocol = require('./constants') | ||
const protocolId = settings.protocolId || 'MQTT' | ||
const protocolVersion = settings.protocolVersion || 4 | ||
let protocolVersion = settings.protocolVersion || 4 | ||
const will = settings.will | ||
@@ -221,8 +221,17 @@ let clean = settings.clean | ||
writeStringOrBuffer(stream, protocolId) | ||
if (settings.bridgeMode) { | ||
protocolVersion += 128 | ||
} | ||
stream.write( | ||
protocolVersion === 4 | ||
? protocol.VERSION4 | ||
: protocolVersion === 5 | ||
? protocol.VERSION5 | ||
: protocol.VERSION3 | ||
protocolVersion === 131 | ||
? protocol.VERSION131 | ||
: protocolVersion === 132 | ||
? protocol.VERSION132 | ||
: protocolVersion === 4 | ||
? protocol.VERSION4 | ||
: protocolVersion === 5 | ||
? protocol.VERSION5 | ||
: protocol.VERSION3 | ||
) | ||
@@ -229,0 +238,0 @@ |
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
152645
4919