您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MqttServerFactory.cs 647 B

1234567891011121314151617181920
  1. using System;
  2. using System.Collections.Generic;
  3. using MQTTnet.Core.Adapter;
  4. using MQTTnet.Core.Diagnostics;
  5. using MQTTnet.Core.Server;
  6. using MQTTnet.Implementations;
  7. namespace MQTTnet
  8. {
  9. public class MqttServerFactory : IMqttServerFactory
  10. {
  11. public IMqttServer CreateMqttServer(MqttServerOptions options, IMqttNetTraceHandler traceHandler = null)
  12. {
  13. if (options == null) throw new ArgumentNullException(nameof(options));
  14. var trace = new MqttNetTrace(traceHandler);
  15. return new MqttServer(options, new List<IMqttServerAdapter> { new MqttServerAdapter(trace) }, trace);
  16. }
  17. }
  18. }