Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » Mosquitto and TCP session(Relation between Mosquitto and TCP session)
Mosquitto and TCP session [message #1835799] Sun, 13 December 2020 16:56 Go to next message
Emanuele Pisano is currently offline Emanuele PisanoFriend
Messages: 1
Registered: December 2020
Junior Member
Hi everybody,
do someone know which kind of relation there is between MQTT session and TCP session?
I mean: when MQTT client connect a new TCP session is created; and when the client disconnect, TCP session is terminated.
But what if TCP session expires before MQTT session?
Until the client sends MQTT PingReq in a reasonable time the TCP session is "refreshed" and will be kept alive, but could happen that TCP session expire before MQTT session? And what will happen then when the client will try to send a message to the broker?
Thank you everybody in advance
Re: Mosquitto and TCP session [message #1835856 is a reply to message #1835799] Tue, 15 December 2020 09:59 Go to previous message
Roger Light is currently offline Roger LightFriend
Messages: 90
Registered: September 2013
Member
Hi Emanuele,

Depending on the MQTT options you set when connecting, an MQTT session will either end at the same time as the TCP connection ends, or will outlive it. In MQTT v3.x, if you set the "clean session" flag to true, then the MQTT session will end at the same time as the TCP connection. If you set it to false, the MQTT session will remain beyond the TCP connection. For MQTT v5.0, the same behaviour is controlled by the session-expiry-interval property. When the TCP connection ends, if the session-expiry-interval is 0, then the MQTT session ends immediately. Otherwise, the MQTT session will end after the number of seconds defined in session-expiry-interval.

If the TCP connection has ended, the client is no longer connected to the broker and so it won't be able to send any more MQTT messages until it reconnects.

I hope that helps.

Roger
Previous Topic:Mosquitto plugins written in rust, help with contents of mosquitto struct
Next Topic:mqtt websocket ports
Goto Forum:
  


Current Time: Fri Apr 26 10:35:27 GMT 2024

Powered by FUDForum. Page generated in 0.02862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top