HiveMQtt 0.18.1
See the version list below for details.
dotnet add package HiveMQtt --version 0.18.1
NuGet\Install-Package HiveMQtt -Version 0.18.1
<PackageReference Include="HiveMQtt" Version="0.18.1" />
paket add HiveMQtt --version 0.18.1
#r "nuget: HiveMQtt, 0.18.1"
// Install HiveMQtt as a Cake Addin #addin nuget:?package=HiveMQtt&version=0.18.1 // Install HiveMQtt as a Cake Tool #tool nuget:?package=HiveMQtt&version=0.18.1
The Spectacular C# MQTT Client for .NET
- Easy-to-Install: Available as a Nuget package.
- Compliant: Fully compliant with the MQTT 5.0 specification.
- Works with Any MQTT 5.0 Broker: Built by HiveMQ but not only for HiveMQ.
- Opensource: No blackbox code. Only trusted, tested and reviewed opensource code.
- Easy to Use: Smart defaults, excellent interfaces and intelligent automation makes implementing a breeze.
- Fast: Optimized & benchmarked. See the benchmark results here.
- Actively Maintained: Built by the MQTT professionals that built HiveMQ (and do this for a living).
- Extensively Documented: What good is it without excellent documentation?
- Supported: Contact us anytime in this repository, in the community forum or through support.
- Extensive Event System: Hook into all parts of the client down to the packet level with built in events.
- Global and Per-Subscription Message Handling: Use multiple targeted handlers for more targeted and specialized message processing.
- Full Last Will & Testament Support: Reliable message delivery and notification of client disconnections.
- Observable: Configure up to TRACE level logging for package internals.
- Secure Client Identification: Full support for X.509 client certificates and TLS connections.
- Globally Compatible: Built to be a fully compliant MQTT 5.0 client compatible with all reputable MQTT brokers.
- Multi-Targeted: Supports .NET 6.0, 7.0 & 8.0
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.
What is this?
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 a the temperature from a remote sensor, send a control message to a factory robot, tunnel WhatsApp messages to a Twitter 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.
MQTT Resources
- MQTT Essentials (Great for beginners wanting an introduction)
- MQTT Toolbox
- MQTT Client Library Encyclopedia
- HiveMQ Public Broker
- HiveMQ Support
Need an MQTT Broker?
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, checkout our premium editions or alternatively HiveMQ Cloud which is free to connect up to 100 devices (no credit card required).
Install
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.
Example
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 an 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");
For a Quickstart, more examples and walkthroughs, see the documentation.
Other MQTT Clients
For a list of all known MQTT clients, see MQTT.org.
🛡 License
This project is licensed under the terms of the Apache Software License 2.0
license. See LICENSE for more details.
📃 Citation
@misc{hivemq-mqtt-client-dotnet,
author = {HiveMQ GmbH},
title = {The HiveMQ C# MQTT client for .NET},
year = {2024},
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 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- NLog (>= 5.2.3)
- System.IO.Pipelines (>= 7.0.0)
-
net7.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- NLog (>= 5.2.3)
- System.IO.Pipelines (>= 7.0.0)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- NLog (>= 5.2.3)
- System.IO.Pipelines (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HiveMQtt:
Package | Downloads |
---|---|
MQContract.HiveMQ
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.23.0 | 3,851 | 9/6/2024 |
0.22.1 | 1,207 | 7/22/2024 |
0.22.0 | 476 | 7/5/2024 |
0.21.0 | 100 | 7/2/2024 |
0.20.0 | 92 | 6/27/2024 |
0.19.1 | 103 | 6/24/2024 |
0.19.0 | 295 | 6/17/2024 |
0.18.1 | 374 | 6/10/2024 |
0.18.0 | 53 | 6/10/2024 |
0.17.0 | 451 | 6/4/2024 |
0.16.0 | 102 | 5/31/2024 |
0.15.1 | 110 | 5/29/2024 |
0.15.0 | 81 | 5/28/2024 |
0.14.0 | 217 | 5/21/2024 |
0.13.0 | 177 | 5/17/2024 |
0.12.0 | 254 | 5/7/2024 |
0.11.5 | 71 | 5/6/2024 |
0.11.4 | 1,802 | 4/16/2024 |
0.11.3 | 322 | 4/5/2024 |
0.11.2 | 141 | 4/3/2024 |
0.11.1 | 2,476 | 3/26/2024 |
0.11.0 | 541 | 3/21/2024 |
0.11.0-rc2 | 76 | 3/19/2024 |
0.10.3 | 1,801 | 2/23/2024 |
0.10.2 | 904 | 2/2/2024 |
0.10.1 | 253 | 1/23/2024 |
0.10.0 | 75 | 1/23/2024 |
0.9.0 | 379 | 1/15/2024 |
0.8.0 | 216 | 1/9/2024 |
0.7.0 | 261 | 12/28/2023 |
0.6.0 | 4,536 | 11/10/2023 |
0.5.0 | 733 | 10/30/2023 |
0.4.3 | 321 | 10/9/2023 |
0.4.1 | 195 | 9/28/2023 |
0.4.0 | 104 | 9/26/2023 |
0.3.0 | 4,403 | 9/7/2023 |
0.2.1 | 1,997 | 8/21/2023 |
0.2.0 | 1,676 | 6/13/2023 |
0.1.10 | 557 | 4/18/2023 |
0.1.9 | 162 | 4/12/2023 |
0.1.9-preview.0.2 | 97 | 4/11/2023 |
0.1.6 | 322 | 3/24/2023 |
0.1.5 | 209 | 3/24/2023 |
0.1.4 | 206 | 3/24/2023 |
0.1.3 | 264 | 2/22/2023 |
0.1.2 | 238 | 2/21/2023 |
0.1.1 | 291 | 2/21/2023 |
The HiveMQtt release details are maintained in Github:
https://github.com/hivemq/hivemq-mqtt-client-dotnet/releases