![]() |
PahoMqttCpp
MQTT C++ Client for POSIX and Windows
|
#include <connect_options.h>
Public Types | |
using | self = connect_options_builder |
Public Member Functions | |
connect_options_builder (int ver=MQTTVERSION_DEFAULT) | |
connect_options_builder (const connect_options &opts) | |
connect_options_builder (const connect_options &&opts) | |
auto | clean_session (bool on=true) -> self & |
template<class Rep, class Period> | |
auto | keep_alive_interval (const std::chrono::duration< Rep, Period > &interval) -> self & |
template<class Rep, class Period> | |
auto | connect_timeout (const std::chrono::duration< Rep, Period > &timeout) -> self & |
auto | user_name (string_ref userName) -> self & |
auto | password (binary_ref password) -> self & |
auto | max_inflight (int n) -> self & |
auto | will (const will_options &will) -> self & |
auto | will (will_options &&will) -> self & |
auto | will (const message &msg) -> self & |
auto | ssl (const ssl_options &ssl) -> self & |
auto | ssl (ssl_options &&ssl) -> self & |
auto | token (const token_ptr &tok) -> self & |
auto | servers (const_string_collection_ptr serverURIs) -> self & |
auto | mqtt_version (int ver) -> self & |
auto | automatic_reconnect (bool on=true) -> self & |
template<class Rep1, class Period1, class Rep2, class Period2> | |
auto | automatic_reconnect (const std::chrono::duration< Rep1, Period1 > &minRetryInterval, const std::chrono::duration< Rep2, Period2 > &maxRetryInterval) -> self & |
auto | clean_start (bool on=true) -> self & |
auto | properties (const mqtt::properties &props) -> self & |
auto | properties (mqtt::properties &&props) -> self & |
auto | http_headers (const name_value_collection &headers) -> self & |
auto | http_headers (name_value_collection &&headers) -> self & |
auto | http_proxy (const string &httpProxy) -> self & |
auto | https_proxy (const string &httpsProxy) -> self & |
connect_options | finalize () |
Static Public Member Functions | |
static connect_options_builder | v3 () |
static connect_options_builder | v5 () |
static connect_options_builder | ws () |
static connect_options_builder | v5_ws () |
Class to build connect options.
This class
|
inlineexplicit |
Default constructor.
ver | The MQTT version for the connection. Defaults to the most recent v3 supported by the server. |
|
inlineexplicit |
Copy constructor from an existing set of options.
|
inlineexplicit |
Move constructor from an existing set of options.
|
inlinestatic |
Creates the default options builder for an MQTT v3.x connection.
|
inlinestatic |
Creates the default options builder for an MQTT v5 connection.
|
inlinestatic |
Creates the default options builder for an MQTT v3.x connection using WebSockets.
The keepalive interval is set to 45 seconds to avoid webserver 60 second inactivity timeouts.
|
inlinestatic |
Creates the default options for an MQTT v5 connection using WebSocketsThe keepalive interval is set to 45 seconds to avoid webserver 60 second inactivity timeouts.
|
inline |
Sets whether the server should remember state for the client across reconnects. (MQTT v3.x only)
on | true if the server should NOT remember state for the client across reconnects, false otherwise. |
|
inline |
Sets the "keep alive" interval with a chrono duration. This is the maximum time that should pass without communications between client and server. If no messages pass in this time, the client will ping the broker.
interval | The keep alive interval. |
|
inline |
Sets the connect timeout with a chrono duration. This is the maximum time that the underlying library will wait for a connection before failing.
timeout | The connect timeout in seconds. |
|
inline |
Sets the user name for the connection.
userName | The user name for the connection. |
|
inline |
Sets the password for the connection.
password | The password for the connection. |
|
inline |
Sets the maximum number of messages that can be in-flight simultaneously.
n | The maximum number of inflight messages. |
|
inline |
Sets the "Last Will and Testament" (LWT) for the connection.
will | The LWT options. |
|
inline |
Sets the "Last Will and Testament" (LWT) for the connection.
will | The LWT options. |
Sets the "Last Will and Testament" (LWT) as a message
msg | The LWT message |
|
inline |
Sets the SSL options for the connection. These will only have an effect if compiled against the SSL version of the Paho C library, and connecting with a secure URI.
ssl | The SSL options. |
|
inline |
Sets the SSL options for the connection. These will only have an effect if compiled against the SSL version of the Paho C library, and connecting with a secure URI.
ssl | The SSL options. |
Sets the callback context to a delivery token.
tok | The delivery token to be used as the callback context. |
|
inline |
Sets the list of servers to which the client will connect.
serverURIs | A pointer to a collection of server URI's. Each entry should be of the form protocol://host:port where protocol must be tcp or ssl. For host, you can specify either an IP address or a domain name. |
|
inline |
Sets the version of MQTT to be used on the connect.
This will also set other connect options to legal values dependent on the selected version.
ver | The MQTT protocol version to use for the connection:
|
|
inline |
Enable or disable automatic reconnects. The retry intervals are not affected.
on | Whether to turn reconnects on or off |
|
inline |
Enable or disable automatic reconnects.
minRetryInterval | Minimum retry interval. Doubled on each failed retry. |
maxRetryInterval | Maximum retry interval. The doubling stops here on failed retries. |
|
inline |
Sets the 'clean start' flag for the connection. (MQTT v5 only)
on | true to set the 'clean start' flag for the connect, false otherwise. |
|
inline |
Sets the properties for the connect message.
props | The properties for the connect message. |
|
inline |
Sets the properties for the connect message.
props | The properties for the connect message. |
|
inline |
Sets the HTTP headers for the connection.
headers | The header nam/value collection. |
|
inline |
Sets the HTTP headers for the connection.
headers | The header nam/value collection. |
Sets the HTTP proxy setting.
httpProxy | The HTTP proxy setting. An empty string means no proxy. |
Sets the secure HTTPS proxy setting.
httpsProxy | The HTTPS proxy setting. An empty string means no proxy. |
|
inline |
Finish building the options and return them.