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

Keep alive period checks based on time period but not on last message #575

Open
David-Prelinger opened this issue Dec 11, 2024 · 2 comments

Comments

@David-Prelinger
Copy link

First of all, thank you for the amazing package.

I do however observe that the regular connection check ping is sent every x seconds, depending on what the user configured. What I would expect is however to only send the ping x seconds after the last mqtt message was received. This would make more sense, because there is no need to check the connection when you just received a message.

The regular connection check somehow destabilized our connection when we had a lot of throughput. So we had to completely disable it.

@shamblett
Copy link
Owner

shamblett commented Dec 12, 2024

I see what your saying but the MQTT spec differs , section 3.1.2.10 Keep Alive -

The Keep Alive is a time interval measured in seconds. Expressed as a 16-bit word, it is the maximum time interval 

that is permitted to elapse between the point at which the Client finishes transmitting one Control Packet and the 

point it starts sending the next. It is the responsibility of the Client to ensure that the interval between Control 

Packets being sent does not exceed the Keep Alive value. In the absence of sending any other Control Packets, the 

Client MUST send a PINGREQ Packet

Keep alive is a function of transmission from the client, not reception from the broker.

Keep alive is not mandatory, in high traffic scenarios where your client receives many publish messages from the broker it may make more sense for you to manage this, i.e. if there is no reception of a publish message for x period of time you know something is wrong in your use case. Other use cases of course differ.

@David-Prelinger
Copy link
Author

Alright that makes sense. Thank you.

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