Paho PUBLISH client disconnected after 200 second

Running Mosquitto 2.0.11. PAHO-MQTT pakage shows 1.6.1 with “MQTT version 5.0/3.1.1 client class”

I have a program, that sends out a 130 byte payload every 10 seconds (will be 10 mins but testing now). I run a mosquitto_sub client on a terminal window. I show the sequence number in the Thonny Python window as well as the in the payload shown by mosquitto_sub.

Mosquitto_sub stops reporting after sequence 20 consistently. While the publisher keeps on sending payloads. The return code from client.publish is 0; I’ve set up an on_publish callback which has only run intermittently. Since this is a publish only program, I am not running a loop. I have QOS set to 1.

The log file shows the following

`2023-04-10T18:11:04: New connection from 192.168.0.101:53587 on port 1883.
2023-04-10T18:11:04: New client connected from 192.168.0.101:53587 as weth-1 (p2, c1, k60).
2023-04-10T18:16:24: Client weth-1 has exceeded timeout, disconnecting.

I changed the max_keepalive to 65535. Again, only 20 publish’s survived. The log message changed.

‘’‘2023-04-10T20:21:07: New connection from 192.168.0.101:46554 on port 1883.
2023-04-10T20:21:07: New client connected from 192.168.0.101:46554 as auto-B3DBD468-5072-B9CE-4051-132 51EF77717 (p2, c1, k60).
2023-04-10T20:21:48: New connection from 192.168.0.101:40795 on port 1883.
2023-04-10T20:21:48: New client connected from 192.168.0.101:40795 as weth-1 (p2, c1, k60).
2023-04-10T20:26:31: Client auto-B3DBD468-5072-B9CE-4051-13251EF77717 disconnected.
2023-04-10T20:26:36: Client weth-1 closed its connection.
‘’’
Any suggestions?

Solved. I thought I’d read a loop wasn’t required for only publishing. I added a loop start and and no longer experience the disconnect

1 Like