I wanted to test a small MQTT Broker that would run in TinyCLR. The use case is for a small network where a central broker isn’t available, and only a small number of pub/sub messages need to be sent. (The idea comes from Bambu Lab printers; they have an internal broker, so a monitoring app can connect directly to the printer without needing to add a broker to the network.)
I haven’t done a full test with a full functional application, and I am not convinced it will be useful in a commercial application. I have only run the broker by itself.
I am not sure what this group’s opinion is on using AI code assistance, but for this, I used Claude Code to refactor the Eclipse Paho M2Mqtt broker library. I can’t take credit for the work; I just came up with the prompts. ![]()
Anyway, the broker can be found here: GitHub - skeller2015/TinyMQTTBroker_v1: MQTT broker for TinyCLR OS 2.4 (GHI SITCore) — two-thread event-loop architecture · GitHub
It can easily be started using the following:
using TinyMQTTBroker;
using TinyMQTTBroker.Messages;// Create and configure the broker
MqttSettings settings = MqttSettings.Instance;
var broker = new MqttBrokerLoop(1883, settings);// Start accepting connections
broker.Start();
See the documentation for the other features/settings.
There is a Python test script found in the /tests directory.
If you have any questions or suggestions, let me know.