MqttControllerFramework 1.0.0-alpha.1
This is a prerelease version of MqttControllerFramework.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MqttControllerFramework --version 1.0.0-alpha.1
NuGet\Install-Package MqttControllerFramework -Version 1.0.0-alpha.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MqttControllerFramework" Version="1.0.0-alpha.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MqttControllerFramework" Version="1.0.0-alpha.1" />
<PackageReference Include="MqttControllerFramework" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MqttControllerFramework --version 1.0.0-alpha.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MqttControllerFramework, 1.0.0-alpha.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MqttControllerFramework@1.0.0-alpha.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MqttControllerFramework&version=1.0.0-alpha.1&prerelease
#tool nuget:?package=MqttControllerFramework&version=1.0.0-alpha.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MqttControllerFramework
A source-generated MQTT controller framework for .NET, built on top of MQTTnet.
Features
- Attribute-driven routing — decorate methods with
[MqttRoute("topic/+")]and the source generator wires them up automatically - Middleware pipeline —
IMqttMiddleware/MqttRequestDelegate(ASP.NET Core–style), with per-message DI scope and connection-scopedSessionItemsfor multi-tenancy - Authentication / Authorization — plug in
IMqttAuthenticationProviderandIMqttAuthorizationProviderwithout touching domain types - Connection validation — optional
IMqttConnectionValidatorhook (ClientId format checks, IP bans, etc.) - Token-bucket rate limiting — per-client / per-topic, configurable via
[TokenBucketRateLimit]attribute - Built-in stats —
IMqttBrokerStatsServiceexposes message counters, byte throughput, and per-topic summaries - TLS hot-swap —
HotSwappableServerCertProviderreloads PEM / PKCS#12 certificates without restart - Multi-target —
net8.0andnet10.0
Quick Start
// Program.cs
builder.Services
.AddMqttServer(builder.Configuration)
.WithControllers<GeneratedMqttControllerRegistration>()
.WithAuthentication<MyAuthProvider>()
.WithAuthorization<MyAuthzProvider>()
.UseMiddleware<TenantMiddleware>()
.WithRateLimiting();
// appsettings.json
"MqttSettings": {
"EnableNonSsl": true,
"NonSslPort": 1883,
"EnableSsl": false
}
// Controller
[MqttController]
public class SensorsController
{
[MqttRoute("sensors/{deviceId}/temperature")]
public async Task OnTemperature(string deviceId, TemperaturePayload payload)
{
// handle message
}
}
Middleware Example (multi-tenancy)
public class TenantMiddleware(ITenantContext tenant) : IMqttMiddleware
{
public Task InvokeAsync(MqttMessageContext ctx, MqttRequestDelegate next)
{
if (ctx.SessionItems["tenantId"] is string tid)
tenant.SetTenant(tid);
return next(ctx);
}
}
SessionItems is populated once during IMqttConnectionValidator.ValidateAsync and persists for the lifetime of the TCP connection, making it ideal for tenant or user resolution.
Status
Alpha — API may change before 1.0. Not recommended for production.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- MQTTnet (>= 5.1.0.1559)
- MQTTnet.AspNetCore (>= 5.1.0.1559)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- MQTTnet (>= 5.1.0.1559)
- MQTTnet.AspNetCore (>= 5.1.0.1559)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 40 | 6/6/2026 |
| 1.0.0-alpha.4 | 38 | 6/6/2026 |
| 1.0.0-alpha.2 | 36 | 6/6/2026 |
| 1.0.0-alpha.1 | 42 | 6/6/2026 |