diff --git a/Source/MQTTnet/Server/IMqttServerOptions.cs b/Source/MQTTnet/Server/IMqttServerOptions.cs index 61900ed..05dab5e 100644 --- a/Source/MQTTnet/Server/IMqttServerOptions.cs +++ b/Source/MQTTnet/Server/IMqttServerOptions.cs @@ -27,5 +27,7 @@ namespace MQTTnet.Server IMqttRetainedMessagesManager RetainedMessagesManager { get; } IMqttServerApplicationMessageInterceptor UndeliveredMessageInterceptor { get; set; } + + IMqttServerClientDisconnectedHandler ClientDisconnectedInterceptor { get; set; } } } \ No newline at end of file diff --git a/Source/MQTTnet/Server/MqttServerOptions.cs b/Source/MQTTnet/Server/MqttServerOptions.cs index b1c595e..45de09c 100644 --- a/Source/MQTTnet/Server/MqttServerOptions.cs +++ b/Source/MQTTnet/Server/MqttServerOptions.cs @@ -33,5 +33,7 @@ namespace MQTTnet.Server public IMqttRetainedMessagesManager RetainedMessagesManager { get; set; } = new MqttRetainedMessagesManager(); public IMqttServerApplicationMessageInterceptor UndeliveredMessageInterceptor { get; set; } + + public IMqttServerClientDisconnectedHandler ClientDisconnectedInterceptor { get; set; } } } diff --git a/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs b/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs index 38c9183..66779c6 100644 --- a/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs +++ b/Source/MQTTnet/Server/MqttServerOptionsBuilder.cs @@ -163,6 +163,18 @@ namespace MQTTnet.Server return this; } + public MqttServerOptionsBuilder WithDisconnectedInterceptor(IMqttServerClientDisconnectedHandler value) + { + _options.ClientDisconnectedInterceptor = value; + return this; + } + + public MqttServerOptionsBuilder WithDisconnectedInterceptor(Action value) + { + _options.ClientDisconnectedInterceptor = new MqttServerClientDisconnectedHandlerDelegate(value); + return this; + } + public MqttServerOptionsBuilder WithApplicationMessageInterceptor(IMqttServerApplicationMessageInterceptor value) { _options.ApplicationMessageInterceptor = value;