Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

mqtt-broker

A production-grade MQTT 3.1.1 broker implementation in Rust.

Features

  • πŸš€ High Performance β€” Async I/O with Tokio, handles 10,000+ concurrent connections
  • πŸ“‘ Full MQTT 3.1.1 β€” All 14 packet types with complete protocol compliance
  • 🎯 QoS 0/1/2 β€” Complete delivery guarantees with proper state machines
  • 🌳 Topic Wildcards β€” O(k) trie-based matching for + and # wildcards
  • πŸ’Ύ Retained Messages β€” Automatic delivery to new subscribers
  • πŸ”„ Session Persistence β€” Clean and persistent session support
  • ⏱️ Keep-Alive β€” Automatic connection timeout detection
  • πŸ›‘οΈ Production Ready β€” Comprehensive test suite with 176+ tests

What is MQTT?

MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe messaging protocol designed for constrained devices and low-bandwidth, high-latency networks. It’s widely used in:

  • IoT (Internet of Things) β€” Sensor data collection, device control
  • Home Automation β€” Smart home devices, lighting, thermostats
  • Mobile Applications β€” Push notifications, real-time messaging
  • Industrial Systems β€” SCADA, telemetry, monitoring

Quick Example

# Terminal 1: Start the broker
mqtt-broker

# Terminal 2: Subscribe to temperature readings
mqtt-consumer "sensors/+/temperature"

# Terminal 3: Publish a temperature reading
mqtt-producer "sensors/living-room/temperature" "23.5Β°C"

Next Steps