No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

ManagedMqttClientExtensions.cs 1.1 KiB

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Threading.Tasks;
  3. using MQTTnet.Core.Packets;
  4. namespace MQTTnet.Core.ManagedClient
  5. {
  6. public static class ManagedMqttClientExtensions
  7. {
  8. public static Task EnqueueAsync(this ManagedMqttClient managedClient, params MqttApplicationMessage[] applicationMessages)
  9. {
  10. if (managedClient == null) throw new ArgumentNullException(nameof(managedClient));
  11. return managedClient.EnqueueAsync(applicationMessages);
  12. }
  13. public static Task SubscribeAsync(this ManagedMqttClient managedClient, params TopicFilter[] topicFilters)
  14. {
  15. if (managedClient == null) throw new ArgumentNullException(nameof(managedClient));
  16. return managedClient.SubscribeAsync(topicFilters);
  17. }
  18. public static Task UnsubscribeAsync(this ManagedMqttClient managedClient, params TopicFilter[] topicFilters)
  19. {
  20. if (managedClient == null) throw new ArgumentNullException(nameof(managedClient));
  21. return managedClient.UnsubscribeAsync(topicFilters);
  22. }
  23. }
  24. }