docs.rs failed to build rumqttc-dev-patched-0.24.4-devpatch
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
rumqttc-dev-patched-0.24.1-devpatch+9a6e605
rumqttc
A pure rust MQTT client which strives to be robust, efficient and easy to use. This library is backed by an async(using tokio) eventloop which enables users to send and receive MQTT messages in correspondence with a broker.
Examples
A simple synchronous publish and subscribe
use ;
use Duration;
use thread;
let mut mqttoptions = new;
mqttoptions.set_keep_alive;
let = new;
client.subscribe.unwrap;
spawn;
// Iterate to poll the eventloop for connection progress
for in connection.iter.enumerate
A simple asynchronous publish and subscribe
use ;
use ;
use Duration;
use Error;
let mut mqttoptions = new;
mqttoptions.set_keep_alive;
let = new;
client.subscribe.await.unwrap;
spawn;
while let Ok = eventloop.poll.await
Quick overview of features
- Eventloop orchestrates outgoing/incoming packets concurrently and handles the state
- Pings the broker when necessary and detects client side half open connections as well
- Throttling of outgoing packets (todo)
- Queue size based flow control on outgoing packets
- Automatic reconnections by just continuing the
eventloop.poll()/connection.iter()
loop - Natural backpressure to client APIs during bad network
- Support for WebSockets
- Secure transport using TLS
In short, everything necessary to maintain a robust connection
Since the eventloop is externally polled (with iter()/poll()
in a loop)
out side the library and Eventloop
is accessible, users can
- Distribute incoming messages based on topics
- Stop it when required
- Access internal state for use cases like graceful shutdown or to modify options before reconnection
Important notes
-
Looping on
connection.iter()
/eventloop.poll()
is necessary to run the event loop and make progress. It yields incoming and outgoing activity notifications which allows customization as you see fit. -
Blocking inside the
connection.iter()
/eventloop.poll()
loop will block connection progress.