Closed cyclamen closed 1 year ago
@cyclamen It's caused by a too short keepalive setting. For more information about keepalive, please refer to MQTT v3 spec 3.1.2.10
opts.SetKeepAlive(60 * time.Second)
@werbenhu
It works!Thanks!
@werbenhu hi, if just set 60s, does it too small?
I use the paho golang client like the codes. The client prints:
2023/09/07 12:36:17 ERROR Connect lost: error=EOF 2023/09/07 12:36:17 INFO Connected 2023/09/07 12:36:27 ERROR Connect lost: error=EOF 2023/09/07 12:36:27 INFO Connected 2023/09/07 12:37:14 ERROR Connect lost: error=EOF 2023/09/07 12:37:14 INFO Connected 2023/09/07 12:37:22 ERROR Connect lost: error=EOF 2023/09/07 12:37:22 INFO Connected 2023/09/07 12:38:58 ERROR Connect lost: error=EOF 2023/09/07 12:38:58 INFO Connected 2023/09/07 12:39:23 ERROR Connect lost: error=EOF 2023/09/07 12:39:23 INFO Connected 2023/09/07 12:39:44 ERROR Connect lost: error=EOF 2023/09/07 12:39:44 INFO Connected 2023/09/07 12:42:52 ERROR Connect lost: error=EOF 2023/09/07 12:42:52 INFO Connected 2023/09/07 12:43:51 ERROR Connect lost: error=EOF 2023/09/07 12:43:51 INFO Connected 2023/09/07 12:43:59 ERROR Connect lost: error=EOF 2023/09/07 12:43:59 INFO Connected .......
and the server log :
12:35PM INF added hook hook=allow-all-auth 12:35PM INF attached listener address=:1883 id=t1 protocol=tcp 12:35PM INF mochi mqtt starting version=2.3.0 12:35PM INF mochi mqtt server started 12:36PM WRN error=EOF listener=t1 12:36PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:54389: i/o timeout" listener=t1 12:36PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:54431: i/o timeout" listener=t1 12:37PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:54474: i/o timeout" listener=t1 12:37PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:54643: i/o timeout" listener=t1 12:38PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:54671: i/o timeout" listener=t1 12:39PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:55054: i/o timeout" listener=t1 12:39PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:55139: i/o timeout" listener=t1 12:42PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:55217: i/o timeout" listener=t1 12:43PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:55913: i/o timeout" listener=t1 12:43PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:56168: i/o timeout" listener=t1 12:44PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:56196: i/o timeout" listener=t1 12:45PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:56332: i/o timeout" listener=t1 12:45PM WRN error="read tcp 10.1.0.213:1883->10.1.0.73:56539: i/o timeout" listener=t1
so, how to make the client be stable.