tuanpmt / esp_mqtt

MQTT client library for ESP8266
http://tuanpm.net/post/esp_mqtt/
MIT License
1.15k stars 401 forks source link

about keepalive #97

Closed baoblackcoal closed 8 years ago

baoblackcoal commented 8 years ago

Hi, i have got a issue, the logs:

MQTT: Sending, type: 12, id: 0000 mqtt_send_keepalive tcp send result=-7 TCP: Disconnected callback MQTT: Disconnected

it has been very frequently, and LWT mssage is easy triggered. for fixing this issue i would be give 3 times chance to send keepalive, is that OK?

baoblackcoal commented 8 years ago

i think i can use the MQTT_SEND_TIMOUT instead of 3

vowstar commented 8 years ago

I got same issue, due to very bad network and special mqtt server configuration. So I changed keepalive interval to half of keepalive, because "If a client does not receive a PINGRESP message within a Keep Alive time period after sending a PINGREQ, it should close the TCP/IP socket connection." in MQTT 3.1 document, I found that half keepalive will stable.