Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Timeout and Keepalive
Timeout and Keepalive [message #1709878] Thu, 01 October 2015 16:56 Go to next message
Edward Woodhouse is currently offline Edward WoodhouseFriend
Messages: 12
Registered: September 2015
Junior Member
Hello, I have read about "keep-alive" in mqtt. The definition I found was "The interval is the longest possible period of time, which broker and client can endure without sending a message".

However, I am unsure exactly what the "timeout" and "keep-alive" values mean for Paho, please could someone who knows explain?

1. After the timeout value expires, is the connection between client and server closed forever?

2. If a keepalive ping receives no response from the server, is the connection between client and server closed forever?

[Updated on: Fri, 02 October 2015 00:19]

Report message to a moderator

Re: Timeout and Keepalive [message #1709987 is a reply to message #1709878] Fri, 02 October 2015 13:42 Go to previous message
Ian Craggs is currently offline Ian CraggsFriend
Messages: 47
Registered: March 2013
Member
Hi Edward.

The definitive meaning of keepalive and expected behaviour can be found in the MQTT specification at http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/csprd02/mqtt-v3.1.1-csprd02.html, but I think you've been reading that.

The keepalive timeout value is set by the client when it connects. A typical value might be 60 (seconds). This means that the MQTT client is expected to send an MQTT packet at least once every 60 seconds. If no other
packet is sent, then a PINGREQ can be used, to which a response is expected (PINGRESP). The intention is to discover "dead" TCP connections, which can, under certain circumstances, accept writes for some time after
the connection has been broken.

If the server does not receive an MQTT packet from the client at least every keepalive interval (plus some grace period, often 150%), then the server will close the TCP connection, for good. This means that the client
has to reconnect. If the client does not receive the PINGRESP from the server within some amount of time (often 150% of the keepalive interval again), the client library will close the TCP connection for good, with the same
effect - the client application has to reconnect.

The keep alive processing can be turned off by setting the interval to 0 on connect.
Previous Topic:WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.)
Next Topic:Post message automatically after connecting
Goto Forum:
  


Current Time: Thu Nov 23 15:10:36 GMT 2017

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

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