pub type Options<'a> = OptionsT<'a, ()>;Expand description
Options with TLS disabled. See OptionsT for documentation.
Aliased Type§
pub struct Options<'a> {Show 13 fields
pub clean_session: bool,
pub keep_alive: u16,
pub client_id: &'a str,
pub last_will: Option<LastWill<'a>>,
pub username: Option<&'a str>,
pub password: Option<&'a [u8]>,
pub no_delay: bool,
pub enabled_ip_versions: IpVersionSet,
pub connection_cfg: (),
pub dns_timeout: Duration,
pub tcp_connect_timeout: Duration,
pub mqtt_connect_timeout: Duration,
pub packets_resend_delay: Duration,
/* private fields */
}Fields§
§clean_session: boolWhether to establish a persistent session or not. If this is set to true,
then the broker will drop any pre-existing session information associated
with the specified Self::client_id. This means that when subscribing to
topics, any retained messages will be (re-)transmitted to this client. In
addition, the broker will not store any information about this session.
Default is false.
keep_alive: u16Time interval (in seconds) between any packet and a PING requests.
Default is 30 seconds.
client_id: &'a strA string identifying this client. The broker may choose to use soemthing different.
It is also used by the broker to establish a persistent session (should
Self::clean_session be false).
last_will: Option<LastWill<'a>>The LastWill is used to publish a message if the client connection ends
in an unexpected manner. This is optional.
Default is None.
username: Option<&'a str>An optional username used to authenticate the client to the broker.
Default is None.
password: Option<&'a [u8]>An optional password used to authenticate the client to the broker.
Default is None.
no_delay: boolSets the “no delay” flag to the TCP connection.
Default is false.
enabled_ip_versions: IpVersionSetA set specifying which Internet Protocol versions to use (IPv4 and/or IPv6) to establish the TCP connection.
By default, both IP versions are enabled.
connection_cfg: ()The TLS configuration used to establish the connection. By default,
this field is empty. Enabling TLS can be done by first enabling the
tls feature in the crate and then using one of the dedicated
functions of OptionsT, such as [OptionsT::enable_tls()].
dns_timeout: DurationThe maximum amount of time that can be spent looking up the broker’s hostname.
By default, this is set to 3 seconds.
tcp_connect_timeout: DurationThe maximum amount of time that can be spent establishing the TCP connection.
By default, this is set to 10 seconds.
mqtt_connect_timeout: DurationThe maximum amount of time waiting for the broker’s CONNACK packet.
By default, this is set to 3 seconds.
packets_resend_delay: DurationHow long the client should wait before re-sending a packet if no acknowledment packet is received. This delay has a low precision.
Default (and minimum) is 1 second.