Merge branch 'develop' of https://github.com/chkr1011/MQTTnet into develop

This commit is contained in:
Christian Kratky
2017-10-28 10:34:32 +02:00
17 changed files with 276 additions and 129 deletions
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using MQTTnet.Core.Server;
namespace MQTTnet.AspnetCore
namespace MQTTnet.AspNetCore
{
public static class ApplicationBuilderExtensions
{
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Options;
using MQTTnet.Core.Adapter;
using MQTTnet.Core.Server;
namespace MQTTnet.AspnetCore
namespace MQTTnet.AspNetCore
{
public class MqttHostedServer : MqttServer, IHostedService
{
@@ -8,7 +8,7 @@ using MQTTnet.Core.Channel;
using MQTTnet.Core.Server;
using MQTTnet.Implementations;
namespace MQTTnet.AspnetCore
namespace MQTTnet.AspNetCore
{
public class MqttWebSocketServerAdapter : IMqttServerAdapter, IDisposable
{
@@ -3,7 +3,7 @@ using Microsoft.Extensions.Hosting;
using MQTTnet.Core.Adapter;
using MQTTnet.Core.Server;
namespace MQTTnet.AspnetCore
namespace MQTTnet.AspNetCore
{
public static class ServiceCollectionExtensions
{
@@ -116,5 +116,14 @@ namespace MQTTnet
{
return _serviceProvider.GetRequiredService<IMqttServer>();
}
public IMqttServer CreateMqttServer(Action<MqttServerOptions> configure)
{
var options = _serviceProvider.GetRequiredService<IOptions<MqttServerOptions>>();
configure(options.Value);
return _serviceProvider.GetRequiredService<IMqttServer>();
}
}
}