Skip to content

Commit

Permalink
Merge commit 'f9951154e2db8000035fdbbde459768fa8beba9f' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure IoT Builder committed Aug 25, 2017
2 parents a22aeb5 + f995115 commit 8467d08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions iothub_client/inc/iothub_client_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ extern "C"

static const char* OPTION_MESSAGE_TIMEOUT = "messageTimeout";
static const char* OPTION_PRODUCT_INFO = "product_info";
/*
* @brief Informs the service of what is the maximum period the client will wait for a keep-alive message from the service.
* The service must send keep-alives before this timeout is reached, otherwise the client will trigger its re-connection logic.
* Setting this option to a low value results in more aggressive/responsive re-connection by the client.
* The default value for this option is 240 seconds, and the minimum allowed is usually 5 seconds.
* To virtually disable the keep-alives from the service (and consequently the keep-alive timeout control on the client-side), set this option to a high value (e.g., UINT_MAX).
*/
static const char* OPTION_C2D_KEEP_ALIVE_FREQ_SECS = "c2d_keep_alive_freq_secs";

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "azure_c_shared_utility/threadapi.h"
#include "azure_c_shared_utility/crt_abstractions.h"
#include "iothub_client.h"
#include "iothub_client_options.h"
#include "iothub_message.h"
#include "iothubtransportamqp.h"

Expand Down Expand Up @@ -170,9 +171,9 @@ void iothub_client_sample_amqp_run(void)
bool traceOn = true;
IoTHubClient_LL_SetOption(iotHubClientHandle, "logtrace", &traceOn);

// Set keep alive is optional. If it is not set the default (240 secs) will be used. If it is zero the service won't send keep alive messages.
// Set keep alive is optional. If it is not set the default (240 secs) will be used.
uint32_t c2d_keep_alive_freq_secs = 120;
IoTHubClient_LL_SetOption(iotHubClientHandle, "c2d_keep_alive_freq_secs", &c2d_keep_alive_freq_secs);
IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_C2D_KEEP_ALIVE_FREQ_SECS, &c2d_keep_alive_freq_secs);

#ifdef MBED_BUILD_TIMESTAMP
// For mbed add the certificate information
Expand Down

0 comments on commit 8467d08

Please sign in to comment.