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.

MqttHostedServer.cs 1.0 KiB

1234567891011121314151617181920212223242526272829303132333435
  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(
  14. IOptions<MqttServerOptions> options,
  15. IEnumerable<IMqttServerAdapter> adapters,
  16. ILogger<MqttServer> logger,
  17. MqttClientSessionsManager clientSessionsManager,
  18. IMqttClientRetainedMessageManager clientRetainedMessageManager
  19. )
  20. : base(options, adapters, logger, clientSessionsManager, clientRetainedMessageManager)
  21. {
  22. }
  23. public Task StartAsync(CancellationToken cancellationToken)
  24. {
  25. return StartAsync();
  26. }
  27. public Task StopAsync(CancellationToken cancellationToken)
  28. {
  29. return StopAsync();
  30. }
  31. }
  32. }