Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last Will troubles #61

Closed
linqFR opened this issue May 25, 2016 · 3 comments
Closed

Last Will troubles #61

linqFR opened this issue May 25, 2016 · 3 comments

Comments

@linqFR
Copy link

linqFR commented May 25, 2016

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

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

from awsIot.device

  • region: the AWS IoT region you will operate in (default 'us-east-1')
  • clientId: the client ID you will use to connect to AWS IoT
  • certPath: path of the client certificate file
  • keyPath: path of the private key file associated with the client certificate
  • caPath: path of your CA certificate file
  • clientCert: same as certPath, but can also accept a buffer containing client certificate data
  • privateKey: same as keyPath, but can also accept a buffer containing private key data
  • caCert: same as caPath, but can also accept a buffer containing CA certificate data
  • autoResubscribe: set to 'true' to automatically re-subscribe to topics after reconnection (default 'true')
  • offlineQueueing: set to 'true' to automatically queue published messages while offline (default 'true')
  • offlineQueueMaxSize: enforce a maximum size for the offline message queue (default 0, e.g. no maximum)
  • offlineQueueDropBehavior: set to 'oldest' or 'newest' to define drop behavior on a full queue when offlineQueueMaxSize > 0
  • drainTimeMs: the minimum time in milliseconds between publishes when draining after reconnection (default 250)
  • baseReconnectTimeMs: the base reconnection time in milliseconds (default 1000)
  • maximumReconnectTimeMs: the maximum reconnection time in milliseconds (default 128000)
  • minimumConnectionTimeMs: the minimum time in milliseconds that a connection must be maintained in order to be considered stable (default 20000)
  • protocol: the connection type, either 'mqtts' (default) or 'wss' (WebSocket/TLS). Note that when set to 'wss', values must be provided for the Access Key ID and Secret Key in either the following options or in environment variables as specified in WebSocket Configuration.
  • websocketOptions: if protocol is set to 'wss', you can use this parameter to pass additional options to the underlying WebSocket object; these options are documented here.
  • accessKeyId: used to specify the Access Key ID when protocol is set to 'wss'. Overrides the environment variable AWS_ACCESS_KEY_ID if set.
  • secretKey: used to specify the Secret Key when protocol is set to 'wss'. Overrides the environment variable AWS_SECRET_ACCESS_KEY if set.
  • sessionToken: (required when authenticating via Cognito, optional otherwise) used to specify the Session Token when protocol is set to 'wss'. Overrides the environment variable AWS_SESSION_TOKEN if set.

from mqtt.Client

  • keepalive: 10 seconds, set to 0 to disable
  • reschedulePings: reschedule ping messages after sending packets (default true)
  • clientId: 'mqttjs_' + Math.random().toString(16).substr(2, 8) duplicate
  • protocolId: 'MQTT'
  • protocolVersion: 4
  • clean: true, set to false to receive QoS 1 and 2 messages while offline
  • reconnectPeriod: 1000 milliseconds, interval between two reconnections
  • connectTimeout: 30 * 1000 milliseconds, time to wait before a CONNACK is received
  • username: the username required by your broker, if any
  • password: the password required by your broker, if any
  • incomingStore: a Store for the incoming packets
  • outgoingStore: a Store for the outgoing packets
  • queueQoSZero: if connection is broken, queue outgoing QoS zero messages (default true)
  • will: a message that will sent by the broker automatically when the client disconnect badly. The format is:
    • topic: the topic to publish
    • payload: the message to publish
    • qos: the QoS
    • retain: the retain flag

BUT, when i connect a thingShadow with following options:

  • clientId
  • caCert
  • clientCert
  • privateKey
  • region
  • will
    • topic : "topicblahblah"
    • payload : "disconnected"
    • qos :0
    • retain : true

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
Copy link
Contributor

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
Copy link
Author

linqFR commented Jun 2, 2016

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
Copy link
Contributor

liuszeng commented Nov 1, 2016

Addressed in release v1.0.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants