Refactor ConnectedClient statistics API

This commit is contained in:
Christian
2018-05-16 00:08:42 +02:00
parent 719838de3b
commit fbf1cbc76e
24 changed files with 306 additions and 350 deletions
@@ -43,6 +43,8 @@ namespace MQTTnet.Implementations
public static Func<MqttClientTcpOptions, IEnumerable<ChainValidationResult>> CustomIgnorableServerCertificateErrorsResolver { get; set; }
public string Endpoint => _socket?.Information?.RemoteAddress?.ToString(); // TODO: Check if contains also the port.
public async Task ConnectAsync(CancellationToken cancellationToken)
{
if (_socket == null)
@@ -41,6 +41,8 @@ namespace MQTTnet.Implementations
public static Func<X509Certificate, X509Chain, SslPolicyErrors, MqttClientTcpOptions, bool> CustomCertificateValidationCallback { get; set; }
public string Endpoint => _socket?.RemoteEndPoint?.ToString();
public async Task ConnectAsync(CancellationToken cancellationToken)
{
if (_socket == null)
@@ -14,17 +14,20 @@ namespace MQTTnet.Implementations
private readonly MqttClientWebSocketOptions _options;
private WebSocket _webSocket;
public MqttWebSocketChannel(MqttClientWebSocketOptions options)
{
_options = options ?? throw new ArgumentNullException(nameof(options));
}
public MqttWebSocketChannel(WebSocket webSocket)
public MqttWebSocketChannel(WebSocket webSocket, string endpoint)
{
_webSocket = webSocket ?? throw new ArgumentNullException(nameof(webSocket));
Endpoint = endpoint;
}
public string Endpoint { get; }
public async Task ConnectAsync(CancellationToken cancellationToken)
{
var uri = _options.Uri;