Forward the publish message to mqtt.js even when offlineQueueing is false
See original GitHub issueMQTT.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:
- Created 5 years ago
- Comments:14 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@lavaxun, I was using
mqtt-nedb-store. But just switch tomqtt-level-storeyesterday.In the aws sdk settings, I am setting
offlineQueuing:falseso 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
ifcondition 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 ofmqtt.jswill take care of queuing.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.