MQTTnet is a high-performance .NET library for MQTT-based communication that provides both client and server implementations supporting MQTT protocol versions up to 5.
The library addresses the need for efficient message-oriented communication in .NET applications by implementing the MQTT protocol with a focus on performance and minimal overhead. It achieves approximately 150,000 messages per second throughput and requires no external dependencies, containing only the low-level MQTT implementation. The tool supports multiple communication channels including TCP, TCP with TLS encryption, and WebSocket connections, with an async-first API design.
Developers should choose MQTTnet for IoT and real-time messaging scenarios within the .NET ecosystem. The client component offers both a low-level implementation for fine-grained control and a managed variant that automatically maintains connections, handles subscriptions, and queues application messages with QoS support. The server component supports multiple simultaneous protocol versions, extensible credential validation, retained message persistence, custom message interception for transformation, and topic-based subscription validation. The library is compatible with Microsoft Azure IoT Hub and works across most .NET Framework versions and CPU architectures, including UWP clients, though UWP servers do not support TLS.
The project maintains comprehensive test coverage with approximately 636 unit tests and includes sample code demonstrating client connection, subscription, publishing, and broker hosting patterns. Development activity shows consistent engagement with the codebase through regular updates and maintenance of the protocol implementation.