Closed CapnBry closed 11 years ago
Thanks for the info. It sounds like you've made these changes already - would you like to test that it works and then raise a pull request?
Yup can do. I've been testing it a few days already. I'll put up a pull request tomorrow. Thanks for the great library!
Doing some network debugging I found that all of my mqtt clients were pinging the server every 10 seconds. The library uses 1/3rd the keepalive interval as the timeout? https://github.com/stevenlovegrove/MqttDotNet/blob/master/MqttLib/Mqtt.cs#L169
That seems arbitrary and the spec already states that the keepalive is the expected interval, with a 50% grace period in addition to the keepalive time. As such, I think the keepalive time specified should be the ping interval rather than 3x the ping interval. The client also should also reset the timer when it publishes a message.
This change is mainly for reducing power usage on battery powered platforms where transmits are somewhat expensive.
Reference: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#keep-alive-timer