Struct paho_mqtt::connect_options::ConnectOptionsBuilder
source · [−]pub struct ConnectOptionsBuilder { /* private fields */ }
Expand description
Builder to create the options to connect to the MQTT server.
Implementations
sourceimpl ConnectOptionsBuilder
impl ConnectOptionsBuilder
sourcepub fn keep_alive_interval(
&mut self,
keep_alive_interval: Duration
) -> &mut Self
pub fn keep_alive_interval(
&mut self,
keep_alive_interval: Duration
) -> &mut Self
Sets the keep alive interval for the client session.
Arguments
keep_alive_interval
The maximum time that should pass without
communication between the client and server.
This has a resolution in seconds.
sourcepub fn clean_session(&mut self, clean: bool) -> &mut Self
pub fn clean_session(&mut self, clean: bool) -> &mut Self
Sets the ‘clean session’ flag to send to the broker.
This is for MQTT v3.x connections only, and if set, will set the other options to be compatible with v3.
Arguments
clean
Whether the broker should remove any previously-stored
information for this client.
sourcepub fn clean_start(&mut self, clean: bool) -> &mut Self
pub fn clean_start(&mut self, clean: bool) -> &mut Self
Sets the ‘clean start’ flag to send to the broker.
This is for MQTT v5 connections only, and if set, will set the other options to be compatible with v5.
Arguments
clean
Whether the broker should remove any previously-stored
information for this client.
sourcepub fn max_inflight(&mut self, max_inflight: i32) -> &mut Self
pub fn max_inflight(&mut self, max_inflight: i32) -> &mut Self
Sets the maximum number of in-flight messages that can be simultaneously handled by this client.
Arguments
max_inflight
The maximum number of messages that can be in-flight
at any given time with this client.
sourcepub fn will_options(&mut self, will: WillOptions) -> &mut Self
👎 Deprecated: Pass in a message with will_message
instead
pub fn will_options(&mut self, will: WillOptions) -> &mut Self
Pass in a message with will_message
instead
sourcepub fn will_message(&mut self, will: Message) -> &mut Self
pub fn will_message(&mut self, will: Message) -> &mut Self
sourcepub fn ssl_options(&mut self, ssl: SslOptions) -> &mut Self
pub fn ssl_options(&mut self, ssl: SslOptions) -> &mut Self
sourcepub fn user_name<S>(&mut self, user_name: S) -> &mut Self where
S: Into<String>,
pub fn user_name<S>(&mut self, user_name: S) -> &mut Self where
S: Into<String>,
Sets the user name for authentication with the broker. This works with the password.
Arguments
user_name
The user name to send to the broker.
sourcepub fn password<S>(&mut self, password: S) -> &mut Self where
S: Into<String>,
pub fn password<S>(&mut self, password: S) -> &mut Self where
S: Into<String>,
Sets the password for authentication with the broker. This works with the user name.
Arguments
password
The password to send to the broker.
sourcepub fn connect_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn connect_timeout(&mut self, timeout: Duration) -> &mut Self
Sets the time interval to allow the connect to complete.
Arguments
timeout
The time interval to allow the connect to
complete. This has a resolution of seconds.
sourcepub fn retry_interval(&mut self, interval: Duration) -> &mut Self
pub fn retry_interval(&mut self, interval: Duration) -> &mut Self
sourcepub fn server_uris<T>(&mut self, server_uris: &[T]) -> &mut Self where
T: AsRef<str>,
pub fn server_uris<T>(&mut self, server_uris: &[T]) -> &mut Self where
T: AsRef<str>,
Specify the servers to which the client will connect.
Arguments
server_uris
The addresses of the brokers to which this client
should connect.
sourcepub fn mqtt_version(&mut self, ver: u32) -> &mut Self
pub fn mqtt_version(&mut self, ver: u32) -> &mut Self
Sets the version of MQTT to use on the connect.
Note that this value can not be greater than the version used to create the client. Specifically, if the client was created for v3, you can not try to connect with v5.
Arguments
ver
The version of MQTT to use when connecting to the broker.
* (0) try the latest version and work backwards
* (3) only try v3.1
* (4) only try v3.1.1
* (5) only try v5
sourcepub fn automatic_reconnect(
&mut self,
min_retry_interval: Duration,
max_retry_interval: Duration
) -> &mut Self
pub fn automatic_reconnect(
&mut self,
min_retry_interval: Duration,
max_retry_interval: Duration
) -> &mut Self
Sets the client to automatically reconnect if the connection is lost.
Arguments
min_retry_interval
The minimum retry interval. Doubled on each
failed retry. This has a resolution in seconds.
max_retry_interval
The maximum retry interval. Doubling stops here
on failed retries. This has a resolution in
seconds.
sourcepub fn properties(&mut self, props: Properties) -> &mut Self
pub fn properties(&mut self, props: Properties) -> &mut Self
Sets the collection of properties for the connections.
Arguments
props
The collection of properties to include with the connect message.
sourcepub fn http_headers<N, V>(&mut self, coll: &[(N, V)]) -> &mut Self where
N: AsRef<str>,
V: AsRef<str>,
pub fn http_headers<N, V>(&mut self, coll: &[(N, V)]) -> &mut Self where
N: AsRef<str>,
V: AsRef<str>,
Sets the additional HTTP headers that will be sent in the WebSocket opening handshake.
sourcepub fn http_proxy<S>(&mut self, proxy: S) -> &mut Self where
S: Into<String>,
pub fn http_proxy<S>(&mut self, proxy: S) -> &mut Self where
S: Into<String>,
sourcepub fn https_proxy<S>(&mut self, proxy: S) -> &mut Self where
S: Into<String>,
pub fn https_proxy<S>(&mut self, proxy: S) -> &mut Self where
S: Into<String>,
sourcepub fn finalize(&self) -> ConnectOptions
pub fn finalize(&self) -> ConnectOptions
Finalize the builder to create the connect options.
Trait Implementations
sourceimpl Default for ConnectOptionsBuilder
impl Default for ConnectOptionsBuilder
sourcefn default() -> ConnectOptionsBuilder
fn default() -> ConnectOptionsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ConnectOptionsBuilder
impl !Send for ConnectOptionsBuilder
impl !Sync for ConnectOptionsBuilder
impl Unpin for ConnectOptionsBuilder
impl UnwindSafe for ConnectOptionsBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more