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

MqttApplicationMessageExtensions.cs 701 B

123456789101112131415161718192021222324
  1. using MQTTnet.Core.Packets;
  2. namespace MQTTnet.Core.Internal
  3. {
  4. internal static class MqttApplicationMessageExtensions
  5. {
  6. public static MqttPublishPacket ToPublishPacket(this MqttApplicationMessage applicationMessage)
  7. {
  8. if (applicationMessage == null)
  9. {
  10. return null;
  11. }
  12. return new MqttPublishPacket
  13. {
  14. Topic = applicationMessage.Topic,
  15. Payload = applicationMessage.Payload,
  16. QualityOfServiceLevel = applicationMessage.QualityOfServiceLevel,
  17. Retain = applicationMessage.Retain,
  18. Dup = false
  19. };
  20. }
  21. }
  22. }