Struct paho_mqtt::async_client::AsyncClientBuilder
[−]
[src]
pub struct AsyncClientBuilder { /* fields omitted */ }
Builder to collect the MQTT asynchronous client creation options.
Methods
impl AsyncClientBuilder
[src]
fn new() -> AsyncClientBuilder
fn server_uri(&mut self, server_uri: &str) -> &mut AsyncClientBuilder
Sets the address for the MQTT broker/server.
Arguments
server_uri
The address of the MQTT broker. It takes the form
protocol://host:port, where protocol must
be tcp or ssl. For host, you can
specify either an IP address or a host name. For instance,
to connect to a server running on the local machines with
the default MQTT port, specify tcp://localhost:1883.
fn client_id(&mut self, client_id: &str) -> &mut AsyncClientBuilder
Sets the client identifier for connection to the broker.
Arguments
client_id
A unique identifier string to be passed to the broker
when the connection is made. This must be a UTF-8 encoded
string. If it is empty, the broker will create and assign
a unique name for the client.
fn persistence(&mut self, on: bool) -> &mut AsyncClientBuilder
Turns default file persistence on or off. When turned on, the client will use the default, file-based, persistence mechanism. This stores information about in-flight messages in persistent storage on the file system, and provides some protection against message loss in the case of unexpected failure. When turned off, the client uses in-memory persistence. If the client crashes or system power fails, the client could lose messages.
Arguments
on
Whether to turn on file-based message persistence.
fn offline_buffering(&mut self, on: bool) -> &mut AsyncClientBuilder
Enables or disables off-line buffering of out-going messages when the client is disconnected.
Arguments
on
Whether or not the application is allowed to publish messages
if the client is off-line.
fn max_buffered_messages(
&mut self,
max_buffered_messages: i32
) -> &mut AsyncClientBuilder
&mut self,
max_buffered_messages: i32
) -> &mut AsyncClientBuilder
Enables off-line buffering of out-going messages when the client is disconnected and sets the maximum number of messages that can be buffered.
Arguments
max_buffered_msgs
The maximum number of messages that the client
will buffer while off-line.
fn finalize(&self) -> AsyncClient
Finalize the builder and create an asynchronous client.