瀏覽代碼

Merge pull request #993 from chkr1011/client-disconnected-handler

Tried to add a MqttServerOptions fluent method for the client disconn…
release/3.x.x
Christian 4 年之前
committed by GitHub
父節點
當前提交
bea6d75251
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 3 個檔案被更改,包括 16 行新增0 行删除
  1. +2
    -0
      Source/MQTTnet/Server/IMqttServerOptions.cs
  2. +2
    -0
      Source/MQTTnet/Server/MqttServerOptions.cs
  3. +12
    -0
      Source/MQTTnet/Server/MqttServerOptionsBuilder.cs

+ 2
- 0
Source/MQTTnet/Server/IMqttServerOptions.cs 查看文件

@@ -27,5 +27,7 @@ namespace MQTTnet.Server
IMqttRetainedMessagesManager RetainedMessagesManager { get; }

IMqttServerApplicationMessageInterceptor UndeliveredMessageInterceptor { get; set; }

IMqttServerClientDisconnectedHandler ClientDisconnectedInterceptor { get; set; }
}
}

+ 2
- 0
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; }
}
}

+ 12
- 0
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<MqttServerClientDisconnectedEventArgs> value)
{
_options.ClientDisconnectedInterceptor = new MqttServerClientDisconnectedHandlerDelegate(value);
return this;
}

public MqttServerOptionsBuilder WithApplicationMessageInterceptor(IMqttServerApplicationMessageInterceptor value)
{
_options.ApplicationMessageInterceptor = value;


Loading…
取消
儲存