7 releases (4 breaking)

0.31.0 Sep 17, 2019
0.30.1 Jan 29, 2019
0.10.1 Oct 20, 2017
0.10.0 Jun 7, 2017
0.3.0 Jul 12, 2016

#26 in #event-loop

Download history 217/week @ 2024-04-01 75/week @ 2024-04-08 109/week @ 2024-04-15 133/week @ 2024-04-22 108/week @ 2024-04-29 102/week @ 2024-05-06 122/week @ 2024-05-13 104/week @ 2024-05-20 156/week @ 2024-05-27 112/week @ 2024-06-03 70/week @ 2024-06-10 109/week @ 2024-06-17 118/week @ 2024-06-24 68/week @ 2024-07-01 40/week @ 2024-07-08 78/week @ 2024-07-15

322 downloads per month
Used in 4 crates

Unlicense

3.5MB
2.5K SLoC

Rust 2.5K SLoC // 0.1% comments Shell 303 SLoC // 0.1% comments Go 93 SLoC

Contains (ELF exe/lib, 6.5MB) utils/toxic/toxic

Build Status Documentation

Pure rust MQTT client which strives to be simple, robust and performant. This library takes an opinionated approach of spawning an eventloop thread where all the mqtt related network io happens. The eventloop takes care of necessary robustness tasks without user having to rethink of all the necessary stuff to implement

Client APIs will communicate with the eventloop over a channel. Check the documentation for possible client operations

FEATURES


Asynchronous

Asynchronous. New publishs/subscriptions doesn't have to wait for the ack of the previous message before sending the next message. Much faster when compared to synchronous calls

Backpressure based on inflight queue length slow networks

Outgoing and incoming streams operating concurrently doesn't mean internal mqtt state buffers grow indefinitely consuming memory. When the inflight message limit is hit, the eventloop stops processing new user requests until inflight queue limit is back to normal and the backpressure will propagate to client calls.

The same is true for slow networks. The channel buffer will nicely smoothen latency spikes but a prolonged bad network will be detected through backpressure.

Throttling

A lot of managed brokers will allow messages only at a certain rate. Any spikes and the broker might disconnect the client. Throttling limit will make sure that this doesn't happen. This is true even for retransmission of internal unacked messages during reconnections.

Automatic reconnections

All the intermittent disconnections are handled with automatic reconnections. But the control to do or not do this is with the user

Miscellaneous

  • On-demand disconnection and reconnections
  • Inbuilt JWT auth for SAAS brokers like GCP iotcore
  • Tls using RustTLS. Cross compilation and multi platform support is painless
  • Automatic resubscription. Not usually necessary when clean_session=false but might help when opensource brokers crash before saving the state

What's not supported

  • Cancelling mqtt will with disconnect packet

Dependencies

~18MB
~417K SLoC