Struct mqtt_async_client::client::ClientBuilder[][src]

pub struct ClientBuilder { /* fields omitted */ }
Expand description

A fluent builder interface to configure a Client.

Note that you must call .set_host() to configure a host to connect to before .build()

Implementations

Build a new Client with this configuration.

Set the destination url for this mqtt connection to the given string (returning an error if the provided string is not a valid URL).

See Self::set_url for more details

Set the destination url for this mqtt connection.

Supported schema are:

  • mqtt: An mqtt session over tcp (default TCP port 1883)
  • mqtts: An mqtt session over tls (default TCP port 8883)
  • ws: An mqtt session over a websocket (default TCP port 80, requires cargo feature “websocket”)
  • wss: An mqtt session over a secure websocket (default TCP port 443, requires cargo feature “websocket”)

If the selected scheme is mqtts or wss, then it will preserve the previously provided tls configuration, if one has been given, or make a new default one otherwise.

Set username to authenticate with.

The default value is no username.

Set password to authenticate with.

The default is no password.

Set keep alive time.

This controls how often ping requests are sent when the connection is idle. See MQTT 3.1.1 specification section 3.1.2.10

The default value is 30 seconds.

Set the tokio runtime to spawn background tasks onto.

The default is to use the default tokio runtime, i.e. tokio::spawn().

Set the ClientId to connect with.

Set the inbound and outbound packet buffer length.

The default is 100.

Set the maximum packet length.

The default is 64 * 1024 bytes.

Set the timeout for operations.

The default is 20 seconds.

Set the TLS ClientConfig for the client-server connection.

Enables TLS. By default TLS is disabled.

Sets the connection mode to the given value

The default is to use Tcp

Set whether to automatically connect and reconnect.

The default is true.

Set the delay between connect retries.

The default is 30s.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.