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.
 
 
 
 

31 lines
1.1 KiB

  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. }