AWS MQTT 'Packet sent. (Length: 2)' periodic message
-
I am successfully using the AWS MQTT lib but noticed that on my Wipy, every 20 seconds the following message is printed: Packet sent. (Length: 2).
It does not register on the AWS console as a message, so what is being sent? Maybe a keep alive message, if so, can I change the interval? Is it even a MQTT message being sent?
Thanks
-
This will be a keepalive packet. You can set the keepalive frequency in the api
-
I tried specifying the keep-alive frequency by passing a value in the connect() method: pycomAwsMQTTClient.connect(900), but still occurs every 20 seconds. Drilling down the source code, this value is thrown away. Look at def _send_connect(self, keepalive, clean_session) method in MQTTClient.py. The keepalive argument is not used. If I remember correctly, AWS specifies a max keep-alive interval of 20 minutes, it's weird that this keep-alive is 20 seconds. Perhaps a result of some late night coding? :)
-
@timh I sm only using part of that library, (the lower levels) and the keepalive does work down there. I am not talking to AWS, but another platform that needs to use TLS.
There are a number of problems with the library as it's currently implemented.
For instance when you disconnect the background thread is not cleaned up, so a reconnect attempt causes problems, without destroying the thread .
So I would not be surprised its really only addressing a minimal working set.
-
@timh Thanks for the heads-up. Are you satisfied with your implementation of MQTT? Meaning you got everything to work reliably and stable? I don't mind writing my own MQTT lib, as long as I can know my efforts won't be pointless because of unstable firmware/micropython/hardware/etc.
-
@inverseeffect using the underlying library that the AWS work is built on seems to work ok. What I haven't had time to do yet is very long running (many days) tests. I did leave an LTE based MQTT connection active with just keepalives going last week, and ended up with a GURU meditation error, after an un caught exception. But the session was active in a console and no code around it. Will look into this more this week.
... Packet sent. (Length: 2) Packet sent. (Length: 2) Packet sent. (Length: 2) Guru Meditation Error: Core 1 panic'ed (StoreProhibited) . Exception was unhandled. Register dump: PC : 0x4017c802 PS : 0x00060433 A0 : 0x8017d867 A1 : 0x3ffe4da0 A2 : 0x00000000 A3 : 0x00000041 A4 : 0xffffff40 A5 : 0xfe5440ff A6 : 0xfe7d983f A7 : 0xfe7e9c3f A8 : 0x8017c802 A9 : 0x3ffe4d80 A10 : 0x3ffe7d98 A11 : 0x400839f8 A12 : 0x00000100 A13 : 0x3ffe7f9c A14 : 0x882072f1 A15 : 0x66316b7d SAR : 0x00000008 EXCCAUSE: 0x0000001d EXCVADDR: 0xfe544103 LBEG : 0x4009b194 LEND : 0x4009b1c2 LCOUNT : 0x00000000 -
@inverseeffect Did you ever get any resolution on the keepalive timer? I'm running into the same issue. For now I've switched to simple.py, but I would much rather use the AWS library.
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