简体   繁体   中英

Paho MQTT Python - Clear topic queue if new message published

I am developing a robotics project which sends a livestream of images. The images are all published to the same topic. What I am finding is that a backlog is created and a delay starts to form between images being sent for publish and them actually being published.

I am assuming there is some form of internal buffer / queueing system in PAHO MQTT which is causing this.

Given the nature of the project I am not precious about each image being published, ideally I'd be able to drop any messages that are waiting to be published to a certain topic and re-publish new content. Does anyone know if this is possible, and if so how?

Thank you

No, this is not possible.

The only thing that would cause messages to back up on the client is if you are publishing them quicker than the client can send them to the broker, which under normal circumstances will be a product of the network speed between the client and the broker.

The only other thing that might have an impact would be if you are manually running the network loop and you are not calling it often enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM