mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 18:43:10 +08:00
Merge pull request #66 from JTrotta/develop
Add support to not persistent Queue
This commit is contained in:
@@ -7,7 +7,7 @@ namespace MQTTnet.Implementations
|
||||
{
|
||||
public class MqttCommunicationAdapterFactory : IMqttCommunicationAdapterFactory
|
||||
{
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(MqttClientOptions options)
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(IMqttClientOptions options)
|
||||
{
|
||||
if (options == null) throw new ArgumentNullException(nameof(options));
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace MQTTnet.Implementations
|
||||
return new MqttChannelCommunicationAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
if (options is MqttClientManagedOptions queuedOptions)
|
||||
{
|
||||
return new MqttChannelCommunicationAdapter(new MqttTcpChannel(queuedOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace MQTTnet.Implementations
|
||||
return _options.TlsOptions.AllowUntrustedCertificates;
|
||||
}
|
||||
|
||||
private static X509CertificateCollection LoadCertificates(MqttClientOptions options)
|
||||
private static X509CertificateCollection LoadCertificates(IMqttClientOptions options)
|
||||
{
|
||||
var certificates = new X509CertificateCollection();
|
||||
if (options.TlsOptions.Certificates == null)
|
||||
|
||||
@@ -9,5 +9,10 @@ namespace MQTTnet
|
||||
{
|
||||
return new MqttClient(new MqttCommunicationAdapterFactory());
|
||||
}
|
||||
|
||||
public IMqttClientManaged CreateMqttManagedClient()
|
||||
{
|
||||
return new MqttClientManaged(new MqttCommunicationAdapterFactory());
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -7,7 +7,7 @@ namespace MQTTnet.Implementations
|
||||
{
|
||||
public class MqttCommunicationAdapterFactory : IMqttCommunicationAdapterFactory
|
||||
{
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(MqttClientOptions options)
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(IMqttClientOptions options)
|
||||
{
|
||||
if (options == null) throw new ArgumentNullException(nameof(options));
|
||||
|
||||
@@ -21,6 +21,12 @@ namespace MQTTnet.Implementations
|
||||
return new MqttChannelCommunicationAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
if (options is MqttClientManagedOptions queuedOptions)
|
||||
{
|
||||
return new MqttChannelCommunicationAdapter(new MqttTcpChannel(queuedOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace MQTTnet.Implementations
|
||||
RawReceiveStream = ReceiveStream;
|
||||
}
|
||||
|
||||
private static Certificate LoadCertificate(MqttClientOptions options)
|
||||
private static Certificate LoadCertificate(IMqttClientOptions options)
|
||||
{
|
||||
if (options.TlsOptions.Certificates == null || !options.TlsOptions.Certificates.Any())
|
||||
{
|
||||
|
||||
@@ -9,5 +9,10 @@ namespace MQTTnet
|
||||
{
|
||||
return new MqttClient(new MqttCommunicationAdapterFactory());
|
||||
}
|
||||
|
||||
public IMqttClientManaged CreateMqttManagedClient()
|
||||
{
|
||||
return new MqttClientManaged(new MqttCommunicationAdapterFactory());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user