Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MqttServerFactory" /> class,
 /// spcifying the transport protocol binding to use and optionally the
 /// authentication provider to enable authentication as part of the connection mechanism.
 /// </summary>
 /// <param name="binding">
 /// Transport protocol binding to use as the MQTT underlying protocol
 /// See <see cref="IMqttServerBinding" /> for more details about how to implement it
 /// </param>
 /// <param name="authenticationProvider">
 /// Optional authentication provider to use,
 /// to enable authentication as part of the connection mechanism
 /// See <see cref="IMqttAuthenticationProvider" /> for more details about how to implement
 /// an authentication provider
 /// </param>
 public MqttServerFactory(IMqttServerBinding binding, IMqttAuthenticationProvider authenticationProvider = null)
 {
     this.binding = binding;
     this.authenticationProvider = authenticationProvider ?? NullAuthenticationProvider.Instance;
 }
 /// <summary>
 /// Creates an <see cref="IMqttServer"/> using the specified MQTT configuration
 /// to customize the protocol parameters, and an optional transport binding and authentication provider.
 /// </summary>
 /// <param name="configuration">
 /// The configuration used for creating the Server.
 /// See <see cref="MqttConfiguration" /> for more details about the supported values.
 /// </param>
 /// <param name="binding">
 /// The binding to use as the underlying transport layer.
 /// Deafault value: <see cref="ServerTcpBinding"/>
 /// See <see cref="IMqttServerBinding"/> for more details about how
 /// to implement a custom binding
 /// </param>
 /// <param name="authenticationProvider">
 /// Optional authentication provider to use,
 /// to enable authentication as part of the connection mechanism.
 /// See <see cref="IMqttAuthenticationProvider" /> for more details about how to implement
 /// an authentication provider.
 /// </param>
 /// <returns>A new MQTT Server</returns>
 /// <exception cref="MqttServerException">MqttServerException</exception>
 public static IMqttServer Create(MqttConfiguration configuration, IMqttServerBinding binding = null, IMqttAuthenticationProvider authenticationProvider = null)
 => new MqttServerFactory(binding ?? new ServerTcpBinding(), authenticationProvider).CreateServer(configuration);