question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forward the publish message to mqtt.js even when offlineQueueing is false

See original GitHub issue

MQTT.js has its own queuing mechanism and store to persist the packets if the device is offline. It handles the condition way better than aws-iot-device-sdk.

Refer to the issue: https://github.com/mqttjs/MQTT.js/issues/818

When the connection is not made, and publish is called, aws-iot-device-sdk maintains its own offline queue. However, if the device is restarted, the data is lost. MQTT.js supports persistent storage, but this SDK does not forward the calls to MQTT.js

Atleast forward the calls when offlineQueueing is set to false

Everything works fine when I removed the if condition at https://github.com/aws/aws-iot-device-sdk-js/blob/234d170c865586f4e49e4b0946100d93f367ee8f/device/index.js#L839

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
dushyantbangalcommented, Oct 10, 2018

@lavaxun, I was using mqtt-nedb-store. But just switch to mqtt-level-store yesterday.

In the aws sdk settings, I am setting offlineQueuing:false so that it doesn’t use its own memory queuing. You supply the mqtt store in the same settings object.

Also, I’m commenting out the if condition mentioned in my previous comment.

With this setting, aws sdk will forward all the publishes to mqtt.js, no matter what the connection status it. The store implementation of mqtt.js will take care of queuing.

1reaction
ColdenCullencommented, Mar 13, 2019

I’m sorry, I saw the last comment about QoS and thought that was the resolution, but I can see now that that’s not the case. Reopening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MQTT.js tutorial - EMQ
MQTT is a lightweight IoT messaging protocol based on the publish/subscribe model. It can provide real-time and reliable messaging services ...
Read more >
mqtt.js | client.connected returns false though client seems to ...
The problem is that the mqtt.connect() call is asynchronous. So it returns before it has actually connected. This means as you test the ......
Read more >
Paho Python MQTT Client - Working with Connections
A client can disconnect gracefully, if it has no more data to send by sending a disconnect message. The Paho client provides the...
Read more >
mqtt - npm
MQTT.js is a client library for the MQTT protocol, ... in the CONNECT message and payload in the PUBLISH message, which are Buffer...
Read more >
MQTT - AWS IoT Core
An MQTT 3 publisher can send an MQTT 3 message to an MQTT 5 subscriber that will be ... Using the AWS IoT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found