-
-
Notifications
You must be signed in to change notification settings - Fork 6
Installation
Fabrício Bracht edited this page Jul 3, 2026
·
1 revision
Add to your Cargo.toml:
[dependencies]
mqtt5 = "0.34"For async runtime, you'll also need Tokio:
[dependencies]
mqtt5 = "0.34"
tokio = { version = "1", features = ["full"] }The mqtt5 crate enables transport-websocket and transport-quic by default.
| Feature | Description | Default |
|---|---|---|
transport-websocket |
WebSocket transport (ws://, wss://) |
Yes |
transport-quic |
QUIC transport (quic://, quics://) |
Yes |
codec-gzip |
gzip payload compression codec | No |
codec-deflate |
deflate payload compression codec | No |
codec-all |
Enable all payload codecs (codec-gzip + codec-deflate) |
No |
opentelemetry |
Distributed tracing with OpenTelemetry (OTLP export) | No |
tokio |
Re-export the Tokio dependency | No |
turmoil-testing |
Deterministic network-simulation testing with turmoil | No |
Disable the defaults to build a TCP/TLS-only client:
mqtt5 = { version = "0.34", default-features = false }Enable optional features as needed:
mqtt5 = { version = "0.34", features = ["opentelemetry", "codec-all"] }cargo install mqttv5-cligit clone https://github.com/LabOverWire/mqtt-lib.git
cd mqtt-lib
cargo build --release -p mqttv5-cli
# Binary is at target/release/mqttv5mqttv5 --version
mqttv5 --help# Latest release
docker pull ghcr.io/laboverwire/mqtt-lib:latest
# Specific version
docker pull ghcr.io/laboverwire/mqtt-lib:0.34.0# Basic broker on port 1883 (anonymous access)
docker run -p 1883:1883 ghcr.io/laboverwire/mqtt-lib broker --allow-anonymous
# With TLS (mount certificates)
docker run -p 1883:1883 -p 8883:8883 \
-v /path/to/certs:/certs:ro \
ghcr.io/laboverwire/mqtt-lib broker \
--allow-anonymous \
--tls-cert /certs/server.pem \
--tls-key /certs/server.keyThe image sets MQTT5_NON_INTERACTIVE=true, so the broker will not prompt for
missing arguments.
The image exposes the following ports:
| Port | Protocol |
|---|---|
| 1883 | MQTT (TCP) |
| 8883 | MQTTS (TLS) |
| 8080 | WebSocket |
| 8443 | WebSocket TLS |
| 14567/udp | QUIC |
For embedded systems or when you only need packet encoding:
[dependencies]
mqtt5-protocol = { version = "0.14", default-features = false }The std feature is enabled by default (pulls in thiserror and tracing);
disabling default features builds for no_std (requires alloc).
See Embedded Guide for target-specific configuration.
npm install mqtt5-wasmyarn add mqtt5-wasmimport init, { MqttClient } from "mqtt5-wasm";
await init();
const client = new MqttClient("my-client");See WASM Guide for complete browser setup.
| Platform | Crate | Notes |
|---|---|---|
| Linux x86_64 | mqtt5, mqttv5-cli | Full support |
| Linux ARM64 | mqtt5, mqttv5-cli | Full support |
| macOS x86_64 | mqtt5, mqttv5-cli | Full support |
| macOS ARM64 | mqtt5, mqttv5-cli | Full support (Apple Silicon) |
| Windows x86_64 | mqtt5, mqttv5-cli | Full support |
| WebAssembly | mqtt5-wasm | Browser only |
| ARM Cortex-M | mqtt5-protocol | no_std |
| RISC-V | mqtt5-protocol | no_std |
| ESP32 | mqtt5-protocol | no_std |
Getting Started
Broker Guide
Client Guide
Platform Guides
CLI Reference
Development