您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

24 行
840 B

  1. using System.Collections.Generic;
  2. using System.Linq;
  3. namespace MQTTnet.Packets
  4. {
  5. public sealed class MqttSubscribePacket : MqttBasePacket, IMqttPacketWithIdentifier
  6. {
  7. public ushort PacketIdentifier { get; set; }
  8. public List<MqttTopicFilter> TopicFilters { get; set; } = new List<MqttTopicFilter>();
  9. /// <summary>
  10. /// Added in MQTT V5.
  11. /// </summary>
  12. public MqttSubscribePacketProperties Properties { get; set; } = new MqttSubscribePacketProperties();
  13. public override string ToString()
  14. {
  15. var topicFiltersText = string.Join(",", TopicFilters.Select(f => f.Topic + "@" + f.QualityOfServiceLevel));
  16. return string.Concat("Subscribe: [PacketIdentifier=", PacketIdentifier, "] [TopicFilters=", topicFiltersText, "]");
  17. }
  18. }
  19. }