Repository navigation
Conversation
An MQTT broker for IoT gateways on the public uringnet API: devices connect and publish; the application in the same process receives every message (OnPublish) and publishes to devices (Publish). - All 14 packet types with strict parsing (variable byte integer of at most 4 bytes, packet size limit, flag checks, UTF-8 without U+0000). - QoS 0, 1 and 2 from publishers (QoS 2 delivered once, deduplicated until PUBREL); subscriptions granted at most QoS 1. - Wildcards + and # in a trie ($-topics excluded from leading wildcards), retained messages, wills, persistent sessions with QoS 1 queued while offline and resent with DUP after a reconnect, session takeover, CONNECT and 1.5x keepalive timeouts. - Authentication and publish/subscribe authorization hooks, OnConnect/ OnDisconnect, Stats. MQTT 5 clients get a v5 CONNACK 0x84. - Delivery writes directly within a ring (Conn.SameLoop) and posts to the subscriber's ring otherwise (Conn.Post, new), where QoS 0 is dropped above MaxClientBuffer so slow subscribers cannot make the broker buffer without limit; QoS 0 packets are encoded once. - Codec and topic matching are platform-independent and tested on any OS; broker tests run on both backends; interop verified with mosquitto_pub/mosquitto_sub; example/mqttbroker. Against Mosquitto 2.0.22 on one core: 1.79x (100 publishers to one subscriber), 2.67x (fan-out to 100 subscribers), 1.75x (1000 publishers). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #34 +/- ##
==========================================
+ Coverage 71.36% 74.92% +3.55%
==========================================
Files 28 31 +3
Lines 2553 3146 +593
==========================================
+ Hits 1822 2357 +535
- Misses 731 789 +58 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An MQTT broker for IoT gateways, on the public uringnet API. Devices connect and publish; the application in the same process receives every message (
OnPublish) and publishes to devices (Publish).Protocol: all 14 packet types, strict parsing; QoS 0/1/2 from publishers (QoS 2 delivered once); subscriptions granted at most QoS 1; wildcards
+/#($-topics excluded), retained messages, wills, persistent sessions (QoS 1 queued offline, resent with DUP after reconnect), session takeover, CONNECT + 1.5× keepalive timeouts; authentication / publish / subscribe hooks;Stats. MQTT 5 clients get a v5 CONNACK 0x84 (mosquitto_pub -V mqttv5prints "Unsupported Protocol Version").Flow control: QoS 1 bounded by inflight window + queue; QoS 0 dropped above
MaxClientBufferfor slow subscribers (test: 20MB flood to a non-reading subscriber stays bounded, others unaffected).uringnet API: adds
Conn.SameLoopandConn.Post(run code on a connection's loop). Delivery writes directly within a ring and posts otherwise; QoS 0 packets encoded once and shared.Tests: 13 broker tests + codec/topic tests (the latter platform-independent, run on macOS too); both backends,
-race, 5×. Interop withmosquitto_pub/mosquitto_sub: QoS 0–2 + wildcard, retained, will, persistent session.vs Mosquitto 2.0.22 (both 1 core, QoS 1 publishers waiting for PUBACK, 64B):
Docs: README (EN/中文), architecture, changelog (Unreleased),
example/mqttbroker.🤖 Generated with Claude Code