![]() |
VOOZH | about |
dotnet add package HiveMQtt --version 0.44.0
NuGet\Install-Package HiveMQtt -Version 0.44.0
<PackageReference Include="HiveMQtt" Version="0.44.0" />
<PackageVersion Include="HiveMQtt" Version="0.44.0" />Directory.Packages.props
<PackageReference Include="HiveMQtt" />Project file
paket add HiveMQtt --version 0.44.0
#r "nuget: HiveMQtt, 0.44.0"
#:package HiveMQtt@0.44.0
#addin nuget:?package=HiveMQtt&version=0.44.0Install as a Cake Addin
#tool nuget:?package=HiveMQtt&version=0.44.0Install as a Cake Tool
๐ HiveMQtt logo
๐ HiveMQ C# MQTT Client banner
๐ NuGet Version
๐ GitHub release (latest by date)
๐ GitHub Workflow Status
๐ NuGet
๐ GitHub
๐ Static Badge
๐ Static Badge
๐ Static Badge
๐ Static Badge
๐ Static Badge
Looking for the Sparkplug Client? Use HiveMQtt.Sparkplug and start with the for quick start guides and examples.
dotnet add package HiveMQtt.Sparkplug and see the for full details.AckAsyncโideal for at-least-once and exactly-once workflows. See the manual ack guide.WithProxy), WebSocket via WithWebSocketProxy. Perfect for corporate networks and firewalls.SecureString to prevent exposure in memory dumps and process memory. Use WithPassword(SecureString) for enhanced security.SecureString. Use WithClientCertificate(path, SecureString) for enhanced security.๐ Get Started Today
Download the HiveMQ C# MQTT Client for .NET and start building your next-generation IoT, industrial automation, or real-time data streaming application with HiveMQ on your side.
Do you have a success story with this client? Let us know. We'd love to feature your story in a blog post or video and you'll get some sweet HiveMQ swag (and publicity) along the way.
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 is used to publish and consume messages over MQTT. So you can get the temperature from a remote sensor, send a control message to a factory robot, tunnel WhatsApp messages to an X account or anything else you can imagine.
This is the client library that speaks with an MQTT broker that delivers messages to their final destination.
Need a broker? Sign up for a free broker at HiveMQ Cloud and be up and running in a couple minutes. Connect up to 100 devices - no credit card required.
This client communicates with an MQTT broker to publish and consume messages. It's built to be compatible with all major MQTT brokers but if you need a broker now run the HiveMQ Community Edition:
docker run --name hivemq-ce -d -p 1883:1883 hivemq/hivemq-ce
This will run the HiveMQ Community Edition broker on localhost port 1883.
If you need advanced features, check out our premium editions or alternatively HiveMQ Cloud which is free to connect up to 100 devices (no credit card required).
This package is available on NuGet.org and can be installed with:
dotnet add package HiveMQtt
See the HiveMQtt NuGet page for more installation options.
The HiveMQtt.Sparkplug package is now available on NuGet. It extends the HiveMQtt client with Sparkplug B 3.0 support for industrial IoT: Host Applications (subscribe to Edge Nodes and Devices, publish NCMD/DCMD) and Edge Nodes (publish NBIRTH/NDATA/NDEATH, DBIRTH/DDATA/DDEATH; receive NCMD/DCMD). Install with:
dotnet add package HiveMQtt.Sparkplug
See the HiveMQtt.Sparkplug NuGet page and the for details and quick start.
The following illustrates the client pattern to connect, subscribe and publish messages.
using HiveMQtt.Client;
using HiveMQtt.MQTT5.Types;
// Setup Client options and instantiate
var options = new HiveMQClientOptionsBuilder().
WithBroker("candy.x39.eu.hivemq.cloud").
WithPort(8883).
WithUseTls(true).
Build();
var client = new HiveMQClient(options);
// Setup application message handlers BEFORE subscribing to a topic
client.OnMessageReceived += (sender, args) =>
{
Console.WriteLine($"Message Received: {args.PublishMessage.PayloadAsString}");
};
// Connect to the MQTT broker
var connectResult = await client.ConnectAsync().ConfigureAwait(false);
// Configure the subscriptions we want and subscribe
var builder = new SubscribeOptionsBuilder();
builder.WithSubscription("topic1", QualityOfService.AtLeastOnceDelivery)
.WithSubscription("topic2", QualityOfService.ExactlyOnceDelivery);
var subscribeOptions = builder.Build();
var subscribeResult = await client.SubscribeAsync(subscribeOptions);
// Publish a message
var publishResult = await client.PublishAsync("topic1/example", "Hello Payload");
The client also supports WebSocket connections (ws:// and wss://). WebSocket is useful when:
using HiveMQtt.Client;
using HiveMQtt.MQTT5.Types;
// Connect via WebSocket (ws://)
var options = new HiveMQClientOptionsBuilder()
.WithWebSocketServer("ws://localhost:8000/mqtt")
.WithClientId("WebSocketClient")
.Build();
// Or connect via secure WebSocket (wss://) with TLS
var secureOptions = new HiveMQClientOptionsBuilder()
.WithWebSocketServer("wss://broker.hivemq.com:8884/mqtt")
.WithClientId("SecureWebSocketClient")
.Build();
var client = new HiveMQClient(secureOptions);
var connectResult = await client.ConnectAsync().ConfigureAwait(false);
// Use the same API for publish/subscribe - works identically to TCP connections
client.OnMessageReceived += (sender, args) =>
{
Console.WriteLine($"WebSocket Message: {args.PublishMessage.PayloadAsString}");
};
await client.SubscribeAsync("my/topic");
await client.PublishAsync("my/topic", "Hello from WebSocket!");
When you need to process or persist messages before the broker is told they were received, enable manual ack. The client won't send PubAck/PubRec until you call AckAsync:
using HiveMQtt.Client;
using HiveMQtt.MQTT5.Types;
var options = new HiveMQClientOptionsBuilder()
.WithBroker("broker.example.com")
.WithPort(1883)
.WithManualAck()
.Build();
var client = new HiveMQClient(options);
client.OnMessageReceived += async (sender, args) =>
{
await ProcessOrPersistAsync(args.PublishMessage);
await client.AckAsync(args); // Safe for any QoS (no-op for QoS 0)
};
await client.ConnectAsync();
await client.SubscribeAsync("orders/#", QualityOfService.AtLeastOnceDelivery);
See the manual acknowledgement guide for Receive Maximum, thread safety, and RawClient usage.
Connect through HTTP proxiesโessential in corporate or restricted networks:
TCP (HTTP CONNECT tunnel):
using System.Net;
using HiveMQtt.Client;
var options = new HiveMQClientOptionsBuilder()
.WithBroker("broker.example.com")
.WithPort(1883)
.WithProxy(new WebProxy("http://proxy.example.com:8080"))
.Build();
var client = new HiveMQClient(options);
await client.ConnectAsync();
WebSocket: Use WithWebSocketProxy(new WebProxy("http://proxy.example.com:8080")) with WithWebSocketServer(...). Both support proxy credentials. Full details: Configure a Proxy Server.
For a Quickstart, more examples and walkthroughs, see the documentation.
For a list of all known MQTT clients, see MQTT.org.
This project is licensed under the terms of the Apache Software License 2.0 license. See LICENSE for more details.
@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}}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 4 NuGet packages that depend on HiveMQtt:
| Package | Downloads |
|---|---|
|
MQContract.HiveMQ
Package Description |
|
|
Mqtt.Controllers
MQTT client library for .NET devs the way we understand things |
|
|
CamposDev.Mqtt
A simple lib for publish into MQTT Broker |
|
|
HiveMQtt.Sparkplug
Sparkplug B 3.0 extension for the HiveMQ MQTT Client. Provides Host Application and Edge Node support for industrial IoT. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.44.0 | 943 | 6/2/2026 |
| 0.43.0 | 5,517 | 5/12/2026 |
| 0.42.1 | 6,509 | 4/29/2026 |
| 0.42.0 | 1,217 | 4/18/2026 |
| 0.41.0 | 24,084 | 2/16/2026 |
| 0.40.0 | 227 | 2/13/2026 |
| 0.39.0 | 4,584 | 1/30/2026 |
| 0.38.0 | 397 | 1/28/2026 |
| 0.37.0 | 383 | 1/22/2026 |
| 0.36.0 | 21,620 | 11/26/2025 |
| 0.35.3 | 5,934 | 11/12/2025 |
| 0.35.2 | 286 | 11/10/2025 |
| 0.35.1 | 206 | 11/8/2025 |
| 0.35.0 | 145 | 11/8/2025 |
| 0.34.0 | 4,737 | 11/2/2025 |
| 0.33.0 | 194 | 10/31/2025 |
| 0.32.0 | 145 | 10/30/2025 |
| 0.31.0 | 239 | 10/28/2025 |
| 0.30.0 | 903 | 10/27/2025 |
| 0.29.0 | 3,789 | 10/27/2025 |
The HiveMQtt release details are maintained in Github:
https://github.com/hivemq/hivemq-mqtt-client-dotnet/releases