#mqtt-client #v3-1 #decoder #blocking-client #3-1-1 #tokio-client #smol #latter

tjiftjaf

Library including an encoder and decoder for MQTT v3.1.1. It also includes a client.

8 releases (5 breaking)

0.8.0 Jan 29, 2026
0.7.1 Dec 15, 2025
0.6.0 Dec 8, 2025
0.5.1 Nov 25, 2025
0.3.2 Nov 13, 2025

#844 in Network programming

Custom license

180KB
3.5K SLoC

tjiftjaf is a Rust library implementing MQTT 3.1.1.

Features

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:

Do not use this crate

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.

Fuzzer

Portions of the code are verified using fuzzing. Make sure to install cargo fuzz before running the examples.

cargo +nightly fuzz run subscribe

List all fuzz targets using:

cargo +nightly fuzz list

Benchmarks

The project uses Criterion.rs to benchmark encoding and decoding speed of packets. Run all benchmarks using:

$ cargo bench

To list all benchmarks run:

$ cargo bench -- --list

You 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"

License

This project is licensed under the Mozilla Public License.

Dependencies

~0–5MB
~112K SLoC