Closed kalsolio closed 4 years ago
I had the same problem with Mosquitto broker. It seems that Mosquitto expecting to receive ping within timeout period regardless of messages sent to client within this period of time (not tested this behavior on other brokers). In "proc" method, "timesinceping" updated when EVERY type of message received, not only ping response and this causes to delay next ping to broker. This, in turn, cause to timeout on broker side and it forcing to close connection.
Solution:
Just remove line 349:
$this->timesinceping = time();
in "proc" method and put it in to "ping" method.
Additionally, this will resolve the problem with timing, when ping request sent twice every time (you can see it in debug log you posted).
Definitely suggest this gets rolled in. For any retained messages, they are re-received constantly when not needed on each reconnect (an expected operation). For any significantly sized retained messages, this could pose a bandwidth issue with a large number subscribers using this library times the many reconnects they make.
Opened pull request...
[2017-09-06 15:33:08] local.DEBUG: eof receive going to reconnect for good measure