is it possible to do 3way handshake only one time with mqtt communication?

Internet of Things IoT Frameworks 3 years ago

5.26K 1 0 0 0

_x000D_ _x000D_ I am using mosquitto_pub to publish the data with TLS using a topic. I am using mosquitto_sub to subscribe to the topic from mosquitto_pub.. Whenever I fire a mosquitto_pub , I noticed that the wireshark can detect a 3 way handshake each time. My Question now is, is it possible for mosquitto to do only one time of a 3 way handshake? just to minimize the time of sending the data and receiving it to the other end. I mean like keep the handshake alive on the first firing of mosquitto_pub, then on the succeeding publishing of message, it will send only the TLS data and not do a 3 way handshake over and over again each time.

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
Omar Tuteehub forum best answer Best Answer 2 weeks ago

That’s actually a really good observation. By default, each time you run mosquitto_pub ragdoll hit , it opens a new TCP/TLS connection to the broker, which is why you see a full 3-way handshake every time. To avoid that overhead, you’d need to keep a persistent connection open instead of starting a new one for every message. You can do this using the Mosquitto client library (like in Python or C) where you connect once and publish repeatedly, or by using mosquitto_pub in a loop with the -l or --stdin-line option to reuse the same connection.


0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum


Q

Azure IoT hub and sending messages with mosquitto_pub

_x000D_ _x000D_ I'm trying to send some simple message with mosquitto_pub to Azure IoT HUB but faced...
Q

How to generate AWS bootstrap certificates with java SDK?

_x000D_ _x000D_ According to this docs I need to generate so-called bootstrap certificates for my Io...
Q

Favoriot post json in vb net

_x000D_ _x000D_ I am looking for solution to encounter my problem. This curl post as your reference...

Important Internet of Things Links