A C implentation of the MQTT Messaging protocol, with some ziggy parts

Stack

  • C
  • Zig
  • React
  • TCP

Links

Neobrutalist design showing a dashboard for the mqtt protocol

🚧 Under Construction: I’m working on filling this space still! Check back soon for updates.

The inspiration

I initially decided to begin building this project after learning the MQTT protocol when I was researching how to build my own iOT device (A curtain closer). Coincidentally, It was also around this time that I learned about the Zig language from the ghostyy terminal, and I really wanted to learn this language so I could maybe contribute to the codebase. This all made reimplementing the protocol from scratch pretty compelling for me to do.

The process

Since this was a networking program, the first thing I wanted to do was build the network loop, which I find the easiest to test. I didn’t do anything super out of the ordinary here, just using native C bind and epoll, rather than using a library, especially since most of it was going to be rewritten in Zig anyways.

Afterwards, I had to start implementing the protocol itself.

The result

The end result is this thing that canhandle this many connections, although it doesn’t necessarily handle malformed requests the best. While it so far has little zig interopatebility.

Resources + FAQ

Beej’s Guide to network programming MQTT protocol documentation How I program in C - youtube video SOL - C MQTT Broker