From 021fa83ba6d21bc7bae36896fc2452ff0b6dc534 Mon Sep 17 00:00:00 2001 From: Mirko Geissler Date: Wed, 14 Oct 2015 16:46:08 +0200 Subject: [PATCH 1/2] Do not shift the pubcomp fixed header by qos This improves mqtt 3.1.1 protocol compatibility and prevents HiveMQ 3 broker from disconnecting the client after subscription. --- generate.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/generate.js b/generate.js index 4113f81..2c4fad5 100644 --- a/generate.js +++ b/generate.js @@ -288,8 +288,6 @@ function confirmation(opts) { if (type === 'pubrel') qos = 1 - else if (type === 'pubcomp') - qos = 2 // Check message ID if ('number' !== typeof id) From 7b12b09c032189704f2aef0921c7087714a2b1fe Mon Sep 17 00:00:00 2001 From: Mirko Geissler Date: Wed, 14 Oct 2015 17:11:45 +0200 Subject: [PATCH 2/2] Fix pubcomp test for mqtt 3.1.1 compatibility --- test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.js b/test.js index ed637ff..a0b7c4c 100644 --- a/test.js +++ b/test.js @@ -522,12 +522,12 @@ testParseGenerate('pubrel', { testParseGenerate('pubcomp', { cmd: 'pubcomp' , retain: false - , qos: 2 + , qos: 0 , dup: false , length: 2 , messageId: 2 }, new Buffer([ - 116, 2, // Header + 112, 2, // Header 0, 2 // Message id ]))