Skip to main content

The HiveMQ MQTT Client for .NET

The official HiveMQ MQTT client library for .NET applications. A fully-featured, high-performance MQTT 5.0 client designed for modern .NET development.

Quick Start

Install via NuGet and connect in minutes:

dotnet add package HiveMQtt

Then check out the Quickstart Guide to begin.

Installation & Compatibility

FeatureDetails
NuGet PackageHiveMQtt
MQTT VersionFull MQTT 5.0 compliance
.NET Support.NET 6.0, 7.0, 8.0 & 9.0
LicenseApache 2.0 (Open Source)

Key Features

Core Capabilities

  • MQTT 5.0 Support: Fully compliant with the latest specification, ensuring compatibility with all modern MQTT brokers
  • Asynchronous Design: High-performance, low-latency communication with concurrent message processing
  • Back Pressure Management: Automatically manages flow to prevent overwhelming the broker or client
  • Automatic Reconnect: Built-in reconnection with exponential backoff strategy

Message Handling

  • Global Message Handlers: Process all incoming messages in one place
  • Per-Subscription Callbacks: Route messages to specific handlers based on topic
  • Full QoS Support: QoS 0, 1, and 2 for reliable message delivery
  • Last Will & Testament: Automatic notification of client disconnections

Security

  • TLS/SSL Encryption: Secure connections out of the box
  • SecureString Support: Secure credential handling to prevent password exposure in memory
  • X.509 Client Certificates: Full support for certificate-based authentication
  • Username/Password Auth: Simple credential-based authentication
  • Security Best Practices: Comprehensive guide for secure implementations

Developer Experience

  • Extensive Event System: Hook into all operations from connection to packet level
  • Detailed Logging: TRACE level logging for debugging
  • Builder Pattern APIs: Fluent interfaces for easy configuration
  • Smart Defaults: Works out of the box with sensible defaults

Performance

Client Options

This library provides two client implementations:

ClientBest For
HiveMQClientMost applications - full features including subscription tracking, per-subscription callbacks, and automatic reconnect
RawClientPerformance-critical scenarios - minimal overhead, no subscription tracking

Support & Maintenance

  • Actively Maintained: Built by the MQTT professionals at HiveMQ
  • Community Support: GitHub Issues and Community Forum
  • Professional Support: HiveMQ Support
  • Open Source: Apache 2.0 licensed - transparent, trusted code

What is MQTT?

MQTT is an open standard protocol for publishing and consuming messages from IoT devices all the way up to mainframes. It's binary, massively performant, and easy to use.

This client library enables you to publish and consume messages over MQTT. Use cases include:

  • Reading sensor data from remote IoT devices
  • Sending control commands to industrial equipment
  • Building real-time messaging applications
  • Implementing event-driven architectures

The client communicates with an MQTT broker that routes messages to their destinations.

Need an MQTT Broker?

Quick Start with Docker

Run HiveMQ Community Edition locally:

docker run --name hivemq-ce -d -p 1883:1883 hivemq/hivemq-ce

This starts a broker on localhost:1883.

Cloud Option

HiveMQ Cloud offers a free tier with up to 100 device connections - no credit card required. For advanced features, see HiveMQ Editions.

Learning Resources

MQTT Fundamentals

Code Examples

Other HiveMQ MQTT Clients

License

License

This project is licensed under the Apache Software License 2.0. See LICENSE for details.

Citation

@misc{hivemq-mqtt-client-dotnet,
author = {HiveMQ GmbH},
title = {The HiveMQ C# MQTT client for .NET},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/hivemq/hivemq-mqtt-client-dotnet}}
}