Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Set TTL for Mqtt Connection(set Time to leave value for Mqtt connection)
Set TTL for Mqtt Connection [message #1750094] Fri, 16 December 2016 05:01 Go to next message
Sandeep Tengale is currently offline Sandeep TengaleFriend
Messages: 1
Registered: December 2016
Junior Member
Hello All,

I am trying to design a system using Eclipse Mqtt Paho. I managed to establish the connection to broker and exchange data with peers using it. It is perfectly working fine.

Now I have to set the TTL (Time to live) parameter to the existing connection. Like the connection is idle for a long duration(no one is using it). I need to end the session and should not allow to connect the same session again.

I tried my best to find a option or callback to achieve this, unable to find one. Is there any method/way to do this possible. Please let me know

Thanks in advance
Re: Set TTL for Mqtt Connection [message #1750350 is a reply to message #1750094] Tue, 20 December 2016 10:01 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
TTL or Keepalive in MQTT doesn't actually take into account the high level activity on the connection (I.e. publishes, subscriptions and incoming messages), It's a method to help detect if the connection has been lost by sending PINGREQ packets to the server once the keepalive is about to expire. This lets the server know that the client is still connected and so does not close down the connection, the server also responds with a PINGRESP packet so that the client also knows that it is connected.

If you want to close the session after a period of inactivity, you will need to write that into the application logic, probably using a timer or something that is restarted every time a message is send or received? Then once your timer expires, you can disconnect cleanly.
Previous Topic:MQTT Subscriber Parallel Processing
Next Topic:MQTTClient_create(...) C lib problem
Goto Forum:

Current Time: Fri Oct 23 00:34:38 GMT 2020

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

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

Back to the top