Use event pattern correctly for incoming server connections.

This commit is contained in:
Christian Kratky
2017-10-17 20:05:04 +02:00
parent ad4585989a
commit 9915cc4492
10 changed files with 44 additions and 34 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ namespace MQTTnet.Core.Adapter
{
public interface IMqttServerAdapter
{
event Action<IMqttCommunicationAdapter> ClientAccepted;
event EventHandler<MqttServerAdapterClientAcceptedEventArgs> ClientAccepted;
Task StartAsync(MqttServerOptions options);
Task StopAsync();
@@ -1,15 +0,0 @@
using MQTTnet.Core.Server;
using System;
namespace MQTTnet.Core.Adapter
{
public class MqttClientConnectedEventArgs : EventArgs
{
public MqttClientConnectedEventArgs(ConnectedMqttClient client)
{
Client = client ?? throw new ArgumentNullException(nameof(client));
}
public ConnectedMqttClient Client { get; }
}
}
@@ -1,15 +0,0 @@
using MQTTnet.Core.Server;
using System;
namespace MQTTnet.Core.Adapter
{
public class MqttClientDisconnectedEventArgs : EventArgs
{
public MqttClientDisconnectedEventArgs(ConnectedMqttClient client)
{
Client = client ?? throw new ArgumentNullException(nameof(client));
}
public ConnectedMqttClient Client { get; }
}
}
@@ -0,0 +1,14 @@
using System;
namespace MQTTnet.Core.Adapter
{
public class MqttServerAdapterClientAcceptedEventArgs : EventArgs
{
public MqttServerAdapterClientAcceptedEventArgs(IMqttCommunicationAdapter client)
{
Client = client ?? throw new ArgumentNullException(nameof(client));
}
public IMqttCommunicationAdapter Client { get; }
}
}