mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
Merge branch 'develop' of https://github.com/chkr1011/MQTTnet into develop
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user