From e0d35ca6c90bfdf7c0af17b66efcee356c6c8cf7 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Thu, 18 Mar 2021 15:45:27 +0900 Subject: [PATCH] Added host and port setter function. It helps simple redirection on the same protocol. --- include/mqtt/client.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/mqtt/client.hpp b/include/mqtt/client.hpp index 199031bae..ba0db606a 100644 --- a/include/mqtt/client.hpp +++ b/include/mqtt/client.hpp @@ -233,6 +233,26 @@ class client : public endpoint { #endif // defined(MQTT_USE_WS) #endif // defined(MQTT_USE_TLS) + /** + * @brief Set host. + * @param host host to connect + * + * The host is used from the next connect() or async_connect() call. + */ + void set_host(std::string host) { + host_ = force_move(host); + } + + /** + * @brief Set port. + * @param port port tp connect + * + * The port is used from the next connect() or async_connect() call. + */ + void set_port(std::string port) { + port_ = force_move(port); + } + /** * @brief Set client id. * @param id client id