You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
883 B

  1. using System.Collections.Generic;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using Microsoft.Extensions.Hosting;
  5. using Microsoft.Extensions.Logging;
  6. using Microsoft.Extensions.Options;
  7. using MQTTnet.Core.Adapter;
  8. using MQTTnet.Core.Server;
  9. namespace MQTTnet.AspNetCore
  10. {
  11. public class MqttHostedServer : MqttServer, IHostedService
  12. {
  13. public MqttHostedServer(IOptions<MqttServerOptions> options, IEnumerable<IMqttServerAdapter> adapters, ILogger<MqttServer> logger, MqttClientSessionsManager clientSessionsManager)
  14. : base(options, adapters, logger, clientSessionsManager)
  15. {
  16. }
  17. public Task StartAsync(CancellationToken cancellationToken)
  18. {
  19. return StartAsync();
  20. }
  21. public Task StopAsync(CancellationToken cancellationToken)
  22. {
  23. return StopAsync();
  24. }
  25. }
  26. }