MqttConnectPacket.cs 987 B

123456789101112131415161718192021222324252627282930313233343536
  1. namespace MQTTnet.Packets
  2. {
  3. public class MqttConnectPacket : MqttBasePacket
  4. {
  5. public string ClientId { get; set; }
  6. public string Username { get; set; }
  7. public byte[] Password { get; set; }
  8. public ushort KeepAlivePeriod { get; set; }
  9. // Also called "Clean Start" in MQTTv5.
  10. public bool CleanSession { get; set; }
  11. public MqttApplicationMessage WillMessage { get; set; }
  12. #region Added in MQTTv5.0.0
  13. public MqttConnectPacketProperties Properties { get; set; }
  14. #endregion
  15. public override string ToString()
  16. {
  17. var passwordText = string.Empty;
  18. if (Password != null)
  19. {
  20. passwordText = "****";
  21. }
  22. return string.Concat("Connect: [ClientId=", ClientId, "] [Username=", Username, "] [Password=", passwordText, "] [KeepAlivePeriod=", KeepAlivePeriod, "] [CleanSession=", CleanSession, "]");
  23. }
  24. }
  25. }