From d5e717a9e60558df333bdcca3801ea841778790b Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Thu, 22 Aug 2024 14:49:07 -0700 Subject: [PATCH 1/2] expose socket options to Mqtt5ClientBuilder --- include/aws/iot/Mqtt5Client.h | 9 +++++++++ source/iot/Mqtt5Client.cpp | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/include/aws/iot/Mqtt5Client.h b/include/aws/iot/Mqtt5Client.h index fbe5b8524..d10812bda 100644 --- a/include/aws/iot/Mqtt5Client.h +++ b/include/aws/iot/Mqtt5Client.h @@ -298,6 +298,15 @@ namespace Aws */ Mqtt5ClientBuilder &WithCertificateAuthority(const Crt::ByteCursor &cert) noexcept; + /** + * Overrides the socket properties of the underlying MQTT connections made by the client. Leave undefined to use + * defaults (no TCP keep alive, 10 second socket timeout). + * + * @param socketOptions - The socket properties of the underlying MQTT connections made by the client + * @return - The Mqtt5ClientBuilder + */ + Mqtt5ClientBuilder &WithSocketOptions(Crt::Io::SocketOptions socketOptions) noexcept; + /** * Sets http proxy options. * diff --git a/source/iot/Mqtt5Client.cpp b/source/iot/Mqtt5Client.cpp index e9cc5226e..fa4b27e72 100644 --- a/source/iot/Mqtt5Client.cpp +++ b/source/iot/Mqtt5Client.cpp @@ -344,6 +344,12 @@ namespace Aws return *this; } + Mqtt5ClientBuilder &Mqtt5ClientBuilder::WithSocketOptions(Crt::Io::SocketOptions socketOptions) noexcept + { + m_options->WithSocketOptions(std::move(socketOptions)); + return *this; + } + Mqtt5ClientBuilder &Mqtt5ClientBuilder::WithHttpProxyOptions( const Crt::Http::HttpClientConnectionProxyOptions &proxyOptions) noexcept { From aa368743011d323b2a268d0232cff4dc980fcb51 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Thu, 22 Aug 2024 14:52:01 -0700 Subject: [PATCH 2/2] fix lint --- include/aws/iot/Mqtt5Client.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/aws/iot/Mqtt5Client.h b/include/aws/iot/Mqtt5Client.h index d10812bda..e1711bcee 100644 --- a/include/aws/iot/Mqtt5Client.h +++ b/include/aws/iot/Mqtt5Client.h @@ -299,8 +299,8 @@ namespace Aws Mqtt5ClientBuilder &WithCertificateAuthority(const Crt::ByteCursor &cert) noexcept; /** - * Overrides the socket properties of the underlying MQTT connections made by the client. Leave undefined to use - * defaults (no TCP keep alive, 10 second socket timeout). + * Overrides the socket properties of the underlying MQTT connections made by the client. Leave undefined + * to use defaults (no TCP keep alive, 10 second socket timeout). * * @param socketOptions - The socket properties of the underlying MQTT connections made by the client * @return - The Mqtt5ClientBuilder