arcoirislabs / cordova-plugin-mqtt

MqTT Cordova Plugin for Apache Cordova (> v3.0)
MIT License
86 stars 49 forks source link

Arguments checking bug #21

Open 4refr0nt opened 8 years ago

4refr0nt commented 8 years ago

If you pass retain = false when publish, then retain is true. Disabling retain flag only if retain option is undefined

                var options = {}
                options.topic = topic;
                options.payload = msg;
                options.qos = 0;
                options.retain = false;
                options.success = function() {};
                options.error = function() {};

                cordova.plugins.CordovaMqTTPlugin.publish(options)
arcoirislabs commented 8 years ago

We will fix the issue soon

snr-lab commented 7 years ago

So there are two bugs in cordova-plugin-mqtt.js file.

  1. When you assign false to retain flag for publishing message it is always gets true. To fix this bug we need to update following line.

(args.retain===undefined) ? (args.retain=false) : (args.retain=true); To (args.retain===undefined) ? (args.retain=false) : "";

  1. For will message configuration also retain flag always gets to true. To fix this bug we need to update following line.

args.willTopicConfig.retain||true To args.willTopicConfig.retain === undefined ? true : args.willTopicConfig.retain

This will not be affected for the value undefined as it already handled previously.

I have created a PR for this retain issue, please approve it.

arcoirislabs commented 7 years ago

@snr-lab Thank you for the PR. Just wanted to know that have you verified completely ??

snr-lab commented 7 years ago

Thank you very much for accepting my PR. I am developing an mqtt app and I am verifying the plugin repeatedly.

I got one bug with my fix when will message is not configured. I have fixed the issue and raised the PR. Please approve it.

snr-lab commented 7 years ago

Can we mark this bug resolved as the issue is fixed?

arcoirislabs commented 7 years ago

We need to see for any more errors. Till then let it be open

Sent from my iPhone

On 27-Jul-2017, at 10:32 AM, Rahul Kundu notifications@github.com wrote:

Can we mark this bug as resolved as the issue is fixed?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

snr-lab commented 7 years ago

I found one more bug. When we set keep alive 0 it automatically get changed to 60000. According to the documentation 0 is also a valid input. It actually disables keep alive feature.

spilz87 commented 3 years ago

Hello

It seems the issue is still there How to merge it in last release ?

amaze-escape commented 2 years ago

I can also confirm that the bug is still there...

arcoirislabs commented 2 years ago

Can you try this https://github.com/ameykshirsagar/cordova-plugin-mqtt