diff --git a/include/aws/iot/Mqtt5Client.h b/include/aws/iot/Mqtt5Client.h index fbe5b8524..e1711bcee 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 {