moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

Add option 'qos2Puback' -easy merge #642

Closed btsimonh closed 7 years ago

btsimonh commented 7 years ago

Add option 'qos2Puback' - if set to true, will modify published qos 2 messages to qos 1 before processing. This results in the messages getting a puback, which fools mqtt.js into not getting stuck when sending qos 2 to mosca. It's an option because the spec does not allow for this? Probably will not suit all clients, but better than mqtt.js dying; a patch over the issue until mosca can get true QOS-2 or QOS-2 pseudo-processing.

This PR replaces the previous for ease of merging and understanding the changes.

btsimonh commented 7 years ago

take a look. not tested, but tests added (maybe travis will tell us if I screwed it up :) ).

mcollina commented 7 years ago

Tests are failing: https://travis-ci.org/mcollina/mosca/jobs/234047506#L1637

btsimonh commented 7 years ago

error in test - sent QoS1 and expected it to disconnect! fixed now hopefully; give travis another 10 minutes. p.s. tests fail on windows? I have to move server tests above persistence tests to see my results - is it because I don't have the backends?

mcollina commented 7 years ago

@btsimonh yes. But you can just run https://github.com/mcollina/mosca/blob/master/test/server.js.

btsimonh commented 7 years ago

for my future reference: node .\node_modules\mocha\bin\mocha --recursive --bail --reporter spec test/server.js still failing (any locally) .... bear with me.

btsimonh commented 7 years ago

not failing locally anymore. Love travis; had actually got the code all in the wrong place. Should be good to go now.

btsimonh commented 7 years ago

all good now, only node4 failing at redis.