Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update timeout doc #138

Merged
merged 6 commits into from
Dec 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/doxygen/timeouts.dox
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The timeouts and the recommended configurations are listed below.
4. [MQTT Receive Polling timeout](@ref mqtt_timeouts_receive_polling)
5. [MQTT Send Retry timeout](@ref mqtt_timeouts_send_retry)
6. [Timeouts for MQTT_ProcessLoop and MQTT_ReceiveLoop APIs](@ref mqtt_timeouts_process_receive_loop)
7. [Timeout for MQTT_Connect](@ref mqtt_timeouts_connect)

@section mqtt_timeouts_transport_send_receive Transport Send and Receive timeouts
These are the network send and read operation blocking timeouts used by the implementation
Expand Down Expand Up @@ -39,10 +40,16 @@ This is to make sure that a Control packet including an MQTT ping request packet
the Transport functions block for the maximum time. MQTT Keep Alive interval can be configured by setting the
`keepAliveIntervalSec` member of the [MQTTContext_t](@ref mqtt_struct_types) structure.

@see @ref mqtt_keepalive

@section mqtt_timeouts_ping_response MQTT Ping Response timeout
MQTT Ping Response timeout is the time to wait for a ping response to an MQTT ping request as part of the keep-alive
mechanism in the MQTT Client. This timeout can be configured independent of the Transport timeouts unlike the MQTT Keep Alive
interval, since a check for this timeout is done by coreMQTT library only after an attempt to receive from Transport layer.
interval, since this timeout only depends on the MQTT broker, the platform and, the network latencies.
leegeth marked this conversation as resolved.
Show resolved Hide resolved

We recommend to use a ping response timeout greater than the P99 ping response latency for the broker and the platform being used.
The P99 value for the ping response latency can be calculated using an MQTT application by experimenting on a sample of devices and
obtaining the data for latency of each ping response from the broker after a ping request is sent.

MQTT Ping Response timeout can be set by defining the configuration @ref MQTT_PINGRESP_TIMEOUT_MS.

Expand Down Expand Up @@ -91,4 +98,17 @@ That means, especially in multi-threaded application, the process loop timeout c
faster than the MQTT Keep Alive interval. If a dummy @ref MQTTGetCurrentTimeFunc_t was passed to @ref mqtt_init_function,
then the timeout must be set to 0.
leegeth marked this conversation as resolved.
Show resolved Hide resolved

@see @ref mqtt_receivetimeout

@section mqtt_timeouts_connect Timeout for MQTT_Connect
This timeout is passed as an argument to @ref mqtt_connect_function. It is the maximum time to wait for an MQTT CONNACK packet. If this value is
set to 0, then instead of a time-based loop, it will attempt to call the Transport Receive function up to a fixed maximum number of times,
leegeth marked this conversation as resolved.
Show resolved Hide resolved
which is defined by @ref MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT.

We recommend to use a timeout value greater than the P99 latency for receiving the MQTT CONNACK packet from the broker on the platform being used.
The P99 value for this latency can be calculated using an MQTT application by experimenting on a sample of devices and obtaining the data for
latency to receive each MQTT CONNACK packet from the broker after an MQTT CONNECT packet is sent.

@see @ref mqtt_receivetimeout
leegeth marked this conversation as resolved.
Show resolved Hide resolved

*/