You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-4Lines changed: 76 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,7 @@ We setup an AWS IoT endpoint and testing device certificate for testing. The AWS
185
185
186
186
### Watson IoT Example
187
187
This example enables the wolfMQTT client to connect to the IBM Watson Internet of Things (WIOT) Platform. The WIOT Platform has a limited test broker called "Quickstart" that allows non-secure connections to exercise the component. The example is located in `/examples/wiot/`. Works with MQTT v5 support enabled.
188
-
**NOTE** The WIOT Platform will be disabled DEC2023. The demo may still be useful for users of IBM Watson IOT.
188
+
**NOTE** The WIOT Platform will be disabled DEC2023. The demo may still be useful for users of IBM Watson IOT.
189
189
190
190
### MQTT-SN Example
191
191
The Sensor Network client implements the MQTT-SN protocol for low-bandwidth networks. There are several differences from MQTT, including the ability to use a two byte Topic ID instead the full topic during subscribe and publish. The SN client requires an MQTT-SN gateway. The gateway acts as an intermediary between the SN clients and the broker. This client was tested with the Eclipse Paho MQTT-SN Gateway, which connects by default to the public Eclipse broker, much like our wolfMQTT Client example. The address of the gateway must be configured as the host. The example is located in `/examples/sn-client/`.
@@ -262,7 +262,7 @@ The initially supported version with full specification support for all features
262
262
263
263
### MQTT v5.0 Specification Support
264
264
265
-
The wolfMQTT client supports connecting to v5 enabled brokers when configured with the `--enable-v5` option.
265
+
The wolfMQTT client supports connecting to v5 enabled brokers when configured with the `--enable-v5` option.
266
266
The following v5.0 specification features are supported by the wolfMQTT client:
267
267
* AUTH packet
268
268
* User properties
@@ -413,6 +413,78 @@ Note: When stress is enabled, the Multithread Example becomes localhost only
413
413
and will not connect to remote servers. Additionally the test `scripts/stress.test`
414
414
is added to `make check`, and all other tests are disabled.
415
415
416
+
## Broker
417
+
418
+
wolfMQTT includes a lightweight MQTT broker implementation suitable for embedded and resource-constrained environments. It supports both MQTT v3.1.1 and v5.0 clients, with optional TLS via wolfSSL.
419
+
420
+
### Features
421
+
422
+
* QoS 0, QoS 1, and QoS 2 publish/subscribe (full QoS 2 flow with PUBREC/PUBREL/PUBCOMP)
423
+
* Retained messages
424
+
* Last Will and Testament (LWT) with v5 Will Delay Interval
425
+
* Wildcard subscriptions (`+` and `#`)
426
+
* Username/password authentication
427
+
* TLS support (requires wolfSSL with `--enable-tls`)
428
+
* Clean session handling with subscription persistence
429
+
* Keep-alive monitoring with automatic client disconnect
430
+
* Unique client ID enforcement (existing session takeover)
431
+
* Static memory mode (`WOLFMQTT_STATIC_MEMORY`) for zero-malloc operation
432
+
433
+
### Building
434
+
435
+
With autotools:
436
+
437
+
```
438
+
./configure --enable-broker
439
+
make
440
+
```
441
+
442
+
With CMake:
443
+
444
+
```
445
+
cmake .. -DWOLFMQTT_BROKER=yes
446
+
cmake --build .
447
+
```
448
+
449
+
### Running
450
+
451
+
```
452
+
./src/mqtt_broker -p 1883
453
+
```
454
+
455
+
For TLS:
456
+
457
+
```
458
+
./src/mqtt_broker -p 8883 -t -A ca-cert.pem -K server-key.pem -c server-cert.pem
459
+
```
460
+
461
+
Run `./src/mqtt_broker -h` to see all available options.
462
+
463
+
### Feature Build Options
464
+
465
+
All broker features are enabled by default. Individual features can be disabled at build time to reduce code and memory footprint on constrained platforms.
When built with `WOLFMQTT_STATIC_MEMORY`, the broker uses fixed-size arrays instead of dynamic allocation. Buffer sizes and limits can be tuned via compile-time macros:
477
+
478
+
| Macro | Default | Description |
479
+
|---|---|---|
480
+
|`BROKER_MAX_CLIENTS`| 8 | Maximum concurrent client connections |
481
+
|`BROKER_MAX_SUBS`| 32 | Maximum total subscriptions |
482
+
|`BROKER_MAX_RETAINED`| 16 | Maximum retained messages |
|`BROKER_MAX_PAYLOAD_LEN`| 4096 | Maximum retained message payload |
486
+
|`BROKER_MAX_WILL_PAYLOAD_LEN`| 256 | Maximum LWT payload size |
487
+
416
488
## WebSocket Support
417
489
418
490
wolfMQTT supports MQTT over WebSockets, allowing clients to connect to MQTT brokers through WebSocket endpoints. This is useful for environments where traditional MQTT ports might be blocked or when integrating with web applications.
@@ -544,11 +616,11 @@ You can test the wolfMQTT client against public brokers supporting websockets:
0 commit comments