This simple code stops publishing to the broker after 20/30 messages. The print(frame) statement continues to work, but no frame is published on the topic:
client = mqtt.Client("myMonitor")
client.connect(broker)
try:
while 1:
# Read data from BUS
frame = RecData(smon)
if frame.count("##") >= 1:
print(frame)
client.publish("salty/monitor",frame)
except KeyboardInterrupt:
print("KeyB Interrupt")
ExitApp()
Where do I am wrong?
You haven't started the client loop, so any message bigger than a single TCP packet will lock up the client.
You need to add client.loop_start()
before the loop