aws / aws-iot-device-sdk-js

SDK for connecting to AWS IoT from a device using JavaScript/Node.js
Apache License 2.0
964 stars 384 forks source link

Last Will troubles #61

Closed linqFR closed 8 years ago

linqFR commented 8 years ago

According to documentation of awsIot.thingShadow(options)

the arguments in options include all those in the device class, with the addition of the following arguments specific to the thingShadow class:

  • operationTimeout: the timeout for thing operations (default 10 seconds)

which means options of awsIot.device(options) and therefore :

options also contains arguments specific to mqtt. See the mqtt client documentation for details of these arguments.

So to sum up, options of awsIot.thingShadow should be :

from awsIot.thingShadow

from awsIot.device

from mqtt.Client

BUT, when i connect a thingShadow with following options:

the thing enters directly to a 'offline, close, reconnect, offline... loop, without any connect event !

After few tests, it appears that giving "retain:true" makes it work improperly ! With "retain:false", it works as expected !

Is it a bug or because AWS message broker cannot retain last wills?

liuszeng commented 8 years ago

Hi @dhamfr ,

Thank you very much for using AWS IoT Node.js SDK.

You are right. AWS IoT currently does not support retained messages. If the retain flag is set, the broker side will close the connection. This is why the SDK itself keeps reconnecting and failing. More details can be found in the documentation here: http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html

Hope that answers your question. Please feel free to reopen the thread if you have more questions.

Thanks, Liusu

linqFR commented 8 years ago

Thanks Liusu ! That is answering my question.

So this issue is the same as for my later issue : PLEASE update your documentation and make it precise ! It would help to spare time and energy for real issues.

As for 'retain' setting, to my opinion, it should be inhibited.

liuszeng commented 8 years ago

Addressed in release v1.0.13.