Expand description
The asynchronous API The Asynchronous client module for the Paho MQTT Rust client library.
This presents an asynchronous API that is similar to the other Paho MQTT clients, but uses Token objects that implement the Futures trait, so can be used in much more flexible ways than the other language clients.
Asynchronous operations return a Token
that is a type of future. It
can be used to determine if an operation has completed, block and wait
for the operation to complete, and obtain the final result.
For example, you can start a connection, do something else, and then
wait for the connection to complete.
use paho_mqtt as mqtt;
let cli = mqtt::AsyncClient::new("mqtt://localhost:1883").unwrap();
// Start an async operation and get the token for it.
let tok = cli.connect(mqtt::ConnectOptions::new());
// ...do something else...
// Wait for the async operation to complete.
tok.wait().unwrap();
Structs§
- Async
Client - An asynchronous MQTT connection client.
Type Aliases§
- Connected
Callback - User callback type for when the client is connected.
- Connection
Lost Callback - User callback type for when the connection is lost from the broker.
- Disconnected
Callback - User callback type for when the client receives a disconnect packet.
- Message
Arrived Callback - User callback signature for when subscribed messages are received.