mochi-mqtt / server

The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
MIT License
1.3k stars 223 forks source link

Add MinimumKeepalive #296

Closed thedevop closed 1 year ago

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 6129664628


Totals Coverage Status
Change from base Build 6126988641: 0.001%
Covered Lines: 5420
Relevant Lines: 5480

💛 - Coveralls
werbenhu commented 1 year ago

@thedevop You cannot directly modify the server-side's keepalive because you cannot synchronize it with the client. The client also needs to use this parameter for sending ping packets.

thedevop commented 1 year ago

For MQTT v5, the server will notify the client to use the MinimumKeepalive. But unfortunately for prior versions, there is no mechanism to notify the client. So we can either add a check for MQTT v5 only, or intentional not honoring the client setting.

thedevop commented 1 year ago

@werbenhu , the more I think about it, this maybe unnecessary, especially this can not be enforced in < MQTT v5 without breaking the spec. Should I just close this PR?

werbenhu commented 1 year ago

@thedevop I agree with @dgduncan suggestion to add a Warn-level log, which would be better.