0

I am confused by the programming model of mqtt. My goal is to deploy a client that periodically retrieves sensor data and publish them on a topic via mqtt paho client.

In the code-examples from paho after every publication they disconnects, but i have also see examples where the client published data without a disconnect message sending after each sensor data publication. What is the best approach ?

Sadik Hasan
  • 173
  • 3
  • 18

1 Answers1

0

If you want to send sensor data frequently, try maintaining the connection. Otherwise you need to send keepalive message regularly.