@@ -1,17 +1,17 @@ | |||||
using System; | |||||
using System.Collections.Concurrent; | |||||
using System.Text; | |||||
using System.Threading; | |||||
using System.Threading.Tasks; | |||||
using MQTTnet.Client; | |||||
using MQTTnet.Client; | |||||
using MQTTnet.Exceptions; | using MQTTnet.Exceptions; | ||||
using MQTTnet.Extensions.Rpc.Options; | using MQTTnet.Extensions.Rpc.Options; | ||||
using MQTTnet.Extensions.Rpc.Options.TopicGeneration; | using MQTTnet.Extensions.Rpc.Options.TopicGeneration; | ||||
using MQTTnet.Protocol; | using MQTTnet.Protocol; | ||||
using System; | |||||
using System.Collections.Concurrent; | |||||
using System.Text; | |||||
using System.Threading; | |||||
using System.Threading.Tasks; | |||||
namespace MQTTnet.Extensions.Rpc | namespace MQTTnet.Extensions.Rpc | ||||
{ | { | ||||
public class MqttRpcClient : IDisposable | |||||
public sealed class MqttRpcClient : IDisposable | |||||
{ | { | ||||
private readonly ConcurrentDictionary<string, TaskCompletionSource<byte[]>> _waitingCalls = new ConcurrentDictionary<string, TaskCompletionSource<byte[]>>(); | private readonly ConcurrentDictionary<string, TaskCompletionSource<byte[]>> _waitingCalls = new ConcurrentDictionary<string, TaskCompletionSource<byte[]>>(); | ||||
private readonly IMqttClient _mqttClient; | private readonly IMqttClient _mqttClient; | ||||
@@ -101,7 +101,7 @@ namespace MQTTnet.Extensions.Rpc | |||||
await _mqttClient.SubscribeAsync(responseTopic, qualityOfServiceLevel).ConfigureAwait(false); | await _mqttClient.SubscribeAsync(responseTopic, qualityOfServiceLevel).ConfigureAwait(false); | ||||
await _mqttClient.PublishAsync(requestMessage).ConfigureAwait(false); | await _mqttClient.PublishAsync(requestMessage).ConfigureAwait(false); | ||||
using (var timeoutCts = new CancellationTokenSource(timeout)) | using (var timeoutCts = new CancellationTokenSource(timeout)) | ||||
using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token)) | using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token)) | ||||
{ | { | ||||
@@ -45,10 +45,6 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="IronPython" Version="2.7.9" /> | <PackageReference Include="IronPython" Version="2.7.9" /> | ||||
<PackageReference Include="IronPython.StdLib" Version="2.7.9" /> | <PackageReference Include="IronPython.StdLib" Version="2.7.9" /> | ||||
<PackageReference Include="Microsoft.AspNetCore.App" /> | |||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" /> | |||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" /> | |||||
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.2.1" /> | |||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.0.0-rc2" /> | <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.0.0-rc2" /> | ||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc2" /> | <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc2" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -1,7 +1,6 @@ | |||||
using MQTTnet.Packets; | using MQTTnet.Packets; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | |||||
namespace MQTTnet.Client.Unsubscribing | namespace MQTTnet.Client.Unsubscribing | ||||
{ | { | ||||
@@ -44,12 +43,12 @@ namespace MQTTnet.Client.Unsubscribing | |||||
return this; | return this; | ||||
} | } | ||||
public MqttClientUnsubscribeOptionsBuilder WithTopicFilter(TopicFilter topicFilter) | public MqttClientUnsubscribeOptionsBuilder WithTopicFilter(TopicFilter topicFilter) | ||||
{ | { | ||||
if (topicFilter is null) throw new ArgumentNullException(nameof(topicFilter)); | if (topicFilter is null) throw new ArgumentNullException(nameof(topicFilter)); | ||||
return WithTopic(topicFilter.Topic); | |||||
return WithTopicFilter(topicFilter.Topic); | |||||
} | } | ||||
public MqttClientUnsubscribeOptions Build() | public MqttClientUnsubscribeOptions Build() | ||||
@@ -1,7 +1,7 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||
<PropertyGroup> | <PropertyGroup> | ||||
<TargetFramework>netcoreapp3.1;net461</TargetFramework> | |||||
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks> | |||||
<IsPackable>false</IsPackable> | <IsPackable>false</IsPackable> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
@@ -18,8 +18,9 @@ | |||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview> | <WindowsXamlEnableOverview>true</WindowsXamlEnableOverview> | ||||
<PackageCertificateKeyFile>MQTTnet.TestApp.UniversalWindows_TemporaryKey.pfx</PackageCertificateKeyFile> | <PackageCertificateKeyFile>MQTTnet.TestApp.UniversalWindows_TemporaryKey.pfx</PackageCertificateKeyFile> | ||||
<PackageCertificateThumbprint>1D7434E482CF034DD18C9E6AB6B12622E08FD733</PackageCertificateThumbprint> | |||||
<PackageCertificateThumbprint>1B25E1E3A70C4FEF793B882295F383301B861796</PackageCertificateThumbprint> | |||||
<RuntimeIdentifiers>win10;win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers> | <RuntimeIdentifiers>win10;win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers> | ||||
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||||
<DebugSymbols>true</DebugSymbols> | <DebugSymbols>true</DebugSymbols> | ||||