How to check whether a message has been published to AWS using MQTT on cellular network
-
Hi !
Objective:
I'm trying to build a hardware module that will periodically push out data to AWS IoT via MQTT( like a heartbeat). I'd like to conserve power by detaching from the network after sending an MQTT message and reconnect prior to sending a new one.Problem:
Seems like AWSMQTT library uses sockets that spawn a new thread for publishing messages. However, there isn't a way to know the status of the thread.
1 - Is there a way to know once the thread successfully sent a message? That could help me as an indicator if the device can be smoothly detached from the network.
2 - Is there a better way to do this then what I've proposed.Thanks in advance!
-
I would try to monitor the length of the output queue. See _io_thread_func in MQTTMsgHandler.py - in there there's the transmit loop and you could add some signaling there to indicate the TX queue is empty.
You'll probably need to modify the code and rename the function so you are not using the builtin frozen ones.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login