finds.dev← search

// the find

LiamBindle/MQTT-C

★ 889 · C · MIT · updated May 2024

A portable MQTT C client for embedded systems and PCs alike.

A minimal MQTT 3.1.1 client in C89, two source files, under 2000 lines. Designed for embedded systems where you can't pull in a full RTOS stack or a heavy client like Paho. The PAL abstraction layer means you can port it to a new platform by implementing a handful of functions.

C89 compliance is real — this actually runs on microcontrollers with old toolchains, not just 'embedded' in name only. The two-file build story is genuinely useful on embedded projects where CMake is overkill and you just want to drop files in. Thread-safety without mandatory RTOS primitives is handled correctly via the PAL. Examples cover OpenSSL, MbedTLS, and BearSSL TLS setups, which saves real time when you need encrypted MQTT.

MQTT 5.0 is not supported — if your broker or use case needs it (user properties, shared subscriptions, message expiry), this is a dead end. Last push was May 2024 and there are open issues; not abandoned but clearly not actively developed. The PAL socket abstraction puts the reconnect burden on the caller, which the reconnect_subscriber example shows but doesn't make easy — you're writing that plumbing yourself. No async/callback-only mode: the synchronous send/receive model requires you to call mqtt_sync from a thread or loop, which is awkward on cooperative schedulers.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →