NetPro.MQTTClient
                             
                            
                                6.0.3-beta.9
                            
                        
                    
        
        
                                This is a prerelease version of NetPro.MQTTClient.
                            
    
    
        
        
                                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 NetPro.MQTTClient --version 6.0.3-beta.9
NuGet\Install-Package NetPro.MQTTClient -Version 6.0.3-beta.9
        
        
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="NetPro.MQTTClient" Version="6.0.3-beta.9" />
        
        
For projects that support PackageReference, copy this XML node into the project file to reference the package.
                    
    
    <PackageVersion Include="NetPro.MQTTClient" Version="6.0.3-beta.9" />
<PackageReference Include="NetPro.MQTTClient" />
        
        
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 NetPro.MQTTClient --version 6.0.3-beta.9
        
        
 The NuGet Team does not provide support for this client. Please contact its maintainers for support.
                    
    
    #r "nuget: NetPro.MQTTClient, 6.0.3-beta.9"
        
        
#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 NetPro.MQTTClient@6.0.3-beta.9
        
        
#: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=NetPro.MQTTClient&version=6.0.3-beta.9&prerelease
#tool nuget:?package=NetPro.MQTTClient&version=6.0.3-beta.9&prerelease
        
        
 The NuGet Team does not provide support for this client. Please contact its maintainers for support.
                    
    
    NetPro.MQTTClient 使用
MQTT客户端类库,支持多服务端,完整示例
使用
安装引用NetPro.MQTTClient
先增加如下配置
"MQTTClientOption": {
		"Enabled": true,
		"ConnectionString": [
			{
				"Key": "1", //连接串key别名,唯一
				"Value": "clientid=netpro;host=mqtt://127.0.0.1:1883;username=netpro;password=netpro;timeout=5000;keepalive=120;cleansession=true;" //别名key对应的连接串
			}
		]
	}
1、基于NetPro.Startup基座
增加环境变量 ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=NetPro.Satrtup
2、无依赖使用
public void ConfigureServices(IServiceCollection services)
{ 
   services.AddMQTTClient(configuration);      
}
服务注入使用
 public class HttpProxyController : ControllerBase
    {
        private readonly ILogger _logger;
        private readonly  MqttClientMulti _mqttClientMulti;
        //构造函数注入
        public HttpProxyController(
            ILogger<DatabaseCurdController> logger
            MqttClientMulti _mqttClientMulti)
        {
            _logger = logger;
            _exampleProxy = exampleProxy;
        }
        [HttpGet("getorcreate")]
        [PostResponseCache(Duration = 2)]
        [ProducesResponseType(200, Type = typeof(ResponseResult))]
        public async Task<IActionResult> GetOrCreateAsync(uint id)
        {
            var _mqttClient = _mqttClientMulti["1"];
            var messagePayload = new MqttApplicationMessageBuilder()
                                .WithTopic("netpro/local")//共享标识$queue和$share
                                .WithPayload($"发布消息-{DateTime.Now}")
                                .WithAtMostOnceQoS()//WithAtMostOnceQoS:Level0ithAtLeastOnceQoS:Level1;WithExactlyOnceQoS:Level2
                                .WithRetainFlag(true)//服务器保持消息,有客户端连接此主题后一条消息;一个主题保留一条消息;
                                 .Build();           //删除消息既发送一条Payload为0的消息即可。
            _mqttPublishClient.PublishAsync(messagePayload);
            return Ok();
        }
    }
                                | 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 was computed. 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 was computed. 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 was computed. 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.
- 
                                                    
net6.0
- MQTTnet (>= 3.1.1)
 - NetPro.Core (>= 6.0.3-beta.9)
 
 
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 | 
|---|---|---|
| 6.0.16 | 314 | 7/24/2023 | 
| 6.0.15 | 543 | 7/19/2022 | 
| 6.0.14 | 516 | 7/10/2022 | 
| 6.0.13 | 542 | 6/15/2022 | 
| 6.0.12 | 533 | 6/15/2022 | 
| 6.0.11 | 519 | 6/15/2022 | 
| 6.0.10 | 544 | 6/11/2022 | 
| 6.0.9 | 562 | 6/8/2022 | 
| 6.0.8 | 551 | 5/26/2022 | 
| 6.0.8-beta.3 | 238 | 5/24/2022 | 
| 6.0.8-beta.2 | 211 | 5/24/2022 | 
| 6.0.7 | 555 | 5/18/2022 | 
| 6.0.6 | 579 | 4/28/2022 | 
| 6.0.5 | 537 | 3/30/2022 | 
| 6.0.5-beta.20 | 206 | 4/27/2022 | 
| 6.0.5-beta.19 | 214 | 4/25/2022 | 
| 6.0.5-beta.18 | 218 | 4/22/2022 | 
| 6.0.5-beta.17 | 217 | 4/16/2022 | 
| 6.0.5-beta.16 | 279 | 4/8/2022 | 
| 6.0.5-beta.15 | 208 | 4/8/2022 | 
| 6.0.5-beta.14 | 222 | 4/7/2022 | 
| 6.0.5-beta.13 | 226 | 4/7/2022 | 
| 6.0.5-beta.12 | 220 | 4/6/2022 | 
| 6.0.5-beta.11 | 219 | 4/6/2022 | 
| 6.0.5-beta.10 | 217 | 3/31/2022 | 
| 6.0.5-beta.9 | 223 | 3/26/2022 | 
| 6.0.5-beta.8 | 229 | 3/22/2022 | 
| 6.0.5-beta.7 | 218 | 3/21/2022 | 
| 6.0.5-beta.6 | 226 | 3/14/2022 | 
| 6.0.5-beta.5 | 221 | 3/2/2022 | 
| 6.0.5-beta.4 | 216 | 2/22/2022 | 
| 6.0.5-beta.3 | 228 | 2/18/2022 | 
| 6.0.5-beta.2 | 223 | 2/18/2022 | 
| 6.0.5-beta.1 | 221 | 2/16/2022 | 
| 6.0.4 | 589 | 2/10/2022 | 
| 6.0.3 | 575 | 2/9/2022 | 
| 6.0.3-beta.9 | 228 | 2/10/2022 | 
| 6.0.3-beta.7 | 249 | 1/27/2022 | 
| 6.0.3-beta.6 | 253 | 1/19/2022 | 
| 6.0.3-beta.5 | 238 | 1/17/2022 | 
| 6.0.3-beta.4 | 239 | 1/16/2022 | 
| 6.0.3-beta.3 | 238 | 1/14/2022 | 
| 6.0.3-beta.2 | 227 | 1/13/2022 | 
| 6.0.3-beta.1 | 267 | 1/11/2022 | 
| 6.0.2 | 463 | 1/6/2022 |