Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

MqttClientExtensions.cs 943 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. namespace MQTTnet.Core.Client
  6. {
  7. public static class MqttClientExtensions
  8. {
  9. public static Task<IList<MqttSubscribeResult>> SubscribeAsync(this IMqttClient client, params TopicFilter[] topicFilters)
  10. {
  11. if (client == null) throw new ArgumentNullException(nameof(client));
  12. if (topicFilters == null) throw new ArgumentNullException(nameof(topicFilters));
  13. return client.SubscribeAsync(topicFilters.ToList());
  14. }
  15. public static Task UnsubscribeAsync(this IMqttClient client, params string[] topicFilters)
  16. {
  17. if (client == null) throw new ArgumentNullException(nameof(client));
  18. if (topicFilters == null) throw new ArgumentNullException(nameof(topicFilters));
  19. return client.UnsubscribeAsync(topicFilters.ToList());
  20. }
  21. }
  22. }