Can Mosquitto keep client connection open?

Asked by Deirdre Corr

Hello,

Is it possible to stop Mosquitto sending a disconnect message to the broker after the client message has been sent? I would like to open the connection, send multiple messages and then close the connection manually to avoid the overhead of disconnecting and reconnecting every time a message is sent.

Question information

Language:
English Edit question
Status:
Answered
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

I assume you're referring to mosquitto_pub - if so, then yes. You can use the "-l" option to read lines from stdin and send each line as an individual message. If this doesn't match what you need, then you would be better off writing your own client. The Paho Python client has a publish.multiple() helper that may be suitable as well.

Can you help with this problem?

Provide an answer of your own, or ask Deirdre Corr for more information if necessary.

To post a message you must log in.