Skip to content

Embedded MQTT v3.11 / v5.0 broker#457

Open
dgarske wants to merge 13 commits intowolfSSL:masterfrom
dgarske:broker
Open

Embedded MQTT v3.11 / v5.0 broker#457
dgarske wants to merge 13 commits intowolfSSL:masterfrom
dgarske:broker

Conversation

@dgarske
Copy link
Contributor

@dgarske dgarske commented Jan 30, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a simple MQTT v5.0 broker for the wolfMQTT library. The implementation provides a lightweight, embeddable broker that supports both static and dynamic memory allocation, making it suitable for both resource-constrained embedded systems and server environments. The broker includes essential MQTT features such as pub/sub messaging, retained messages, Last Will and Testament (LWT), QoS 0-1 support, client authentication, and optional TLS encryption.

Changes:

  • Added complete broker implementation with support for MQTT v3.1.1 and v5.0 protocols
  • Exposed packet encoding/decoding functions as public API for broker use via WOLFMQTT_BROKER build option
  • Fixed existing bug in MQTT_CONNECT_FLAG_GET_QOS macro (missing & operator)
  • Added comprehensive test suite with 14 test cases covering core functionality and TLS support
  • Integrated broker into build systems (autotools and CMake) and CI/CD pipeline

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wolfmqtt/mqtt_types.h Added XSTRCMP macro for string comparison abstraction
wolfmqtt/mqtt_packet.h Changed WOLFMQTT_LOCAL to WOLFMQTT_API for broker-needed functions; fixed QoS extraction macro bug; added broker-specific decode/encode API declarations
wolfmqtt/mqtt_broker.h New header defining broker types (MqttBroker, BrokerClient, BrokerSub, etc.) and public API
src/mqtt_packet.c Implemented broker-side packet decode/encode functions (Connect, ConnectAck, Subscribe, Unsubscribe, UnsubscribeAck, Disconnect)
src/mqtt_broker.c Main broker implementation (2371 lines) with client management, subscription handling, retained messages, topic matching, and LWT support
wolfmqtt/include.am Added mqtt_broker.h to installed headers
src/include.am Added mqtt_broker binary to build
scripts/include.am Added broker.test script to distribution
scripts/broker.test Comprehensive test script with 14 test cases using mosquitto_pub/sub clients
scripts/broker_test/*.pem Test certificates for TLS testing
configure.ac Added --enable-broker option; fixed trailing whitespace
CMakeLists.txt Added WOLFMQTT_BROKER option and broker executable target
.gitignore Added configure~ and src/mqtt_broker to ignore list
.github/workflows/broker-check.yml New CI workflow testing broker with 4 configurations (dynamic/static memory, with/without TLS)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgarske dgarske changed the title Simple MQTT v5.0 broker Embedded MQTT v3.11 / v5.0 broker Feb 6, 2026
@dgarske dgarske marked this pull request as ready for review February 6, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant