tjiftjaf is a Rust library implementing MQTT 3.1.1.
MQTT Client
The crate provides a blocking Client
and an asynchronous Client.
The latter does not require a specific runtime executor.
Take a look at the examples:
- examples/client_with_smol.rs uses the executor smol
- examples/client_with_tokio.rs uses the executor tokio
- examples/blocking_client.rs does not use async.
I created this project to learn more about MQTT, fuzzing, sans-io and zero-copy.
Do not rely on this crate for your own projects. It's unstable. Consider using rumqttc instead.
Portions of the code are verified using fuzzing. Make sure to install
cargo fuzz before
running the examples.
cargo +nightly fuzz run subscribeList all fuzz targets using:
cargo +nightly fuzz listThe project uses Criterion.rs to benchmark encoding and decoding speed of packets. Run all benchmarks using:
$ cargo benchTo list all benchmarks run:
$ cargo bench -- --listYou can plot a flamegraph of a benchmark. First build the benchmark into a binary.
$ cargo bench --no-run
...
Executable benches/decode-encode.rs (target/release/deps/decode_encode-9f10de3c0a084302)Then, invoke the binary with flamegraph. This example runs only 1 benchmark that matches the string 'Publish':
$ flamegraph -- target/release/deps/decode_encode-9f10de3c0a084302 --bench Publish
...
Benchmarking decode/encode Publish: Complete (Analysis Disabled)
...
[ perf record: Captured and wrote 1264.806 MB perf.data (79730 samples) ]
writing flamegraph to "flamegraph.svg"This project is licensed under the Mozilla Public License.