rmqtt-codec

Crates.iormqtt-codec
lib.rsrmqtt-codec
version0.2.0
created_at2025-04-17 14:37:44.588146+00
updated_at2025-09-14 10:04:03.221305+00
descriptionMQTT protocol codec implementation with multi-version support and version negotiation
homepage
repositoryhttps://github.com/rmqtt/rmqtt/tree/master/rmqtt-codec
max_upload_size
id1637883
size216,057
(bittcrafter)

documentation

README

rmqtt-codec

crates.io page docs.rs page

🚀 rmqtt-codec is a high-performance MQTT protocol codec library designed for async environments. It provides full support for multiple MQTT versions with automatic negotiation and zero-copy efficiency, seamlessly integrating with the Tokio ecosystem.

✨ Core Features

  • Multi-Version Support: Full implementation of MQTT v3.1, v3.1.1, and v5.0 specifications
  • Automatic Protocol Negotiation: Smart version detection during the CONNECT handshake phase
  • Zero-Copy Encoding/Decoding: Efficient binary processing using bytes::BytesMut to minimize memory overhead
  • Tokio Integration: Built with tokio_util::codec for smooth async I/O operations
  • Memory Safety: Enforces strict message size limits (default 1MB) to prevent memory-related vulnerabilities

🧩 Architecture Components

  • MqttCodec: Main codec dispatcher for version-aware encoding and decoding
  • MqttPacket: Unified representation of all MQTT packet types across versions
  • version::ProtocolVersion: Handshake-based protocol version detection
  • EncodeError / DecodeError: Dedicated error types for robust error handling during encoding and decoding

📚 Crate Usage

Please add a dependency in 'Cargo. toml':

[dependencies]
rmqtt-codec = "0.1"

🔧 Use Cases

  • Embedded MQTT brokers or clients
  • High-performance message middleware
  • Protocol gateways or custom network services
Commit count: 1739

cargo fmt