class

MQTT::V5::Connect

Inherits MQTT::Header / BinData / Reference / Object

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

Constants

AFTER_DESERIALIZE = [] of Nil

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

ALLOWED_PROPERTIES = [PropertyId::SessionExpiryInterval, PropertyId::ReceiveMaximum, PropertyId::MaximumPacketSize, PropertyId::TopicAliasMaximum, PropertyId::RequestResponseInformation, PropertyId::RequestProblemInformation, PropertyId::UserProperty, PropertyId::AuthenticationMethod, PropertyId::AuthenticationData]
ALLOWED_WILL_PROPERTIES = [PropertyId::WillDelayInterval, PropertyId::PayloadFormatIndicator, PropertyId::MessageExpiryInterval, PropertyId::ContentType, PropertyId::ResponseTopic, PropertyId::CorrelationData, PropertyId::UserProperty]
BEFORE_SERIALIZE = [] of Nil

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

ENDIAN = ["big"]

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

KLASS_NAME = [MQTT::V5::Connect]

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

PARTS = [{type: "basic", name: name_size, cls: UInt16, onlyif: nil, verify: nil, value: -> do name.bytesize end, endian: nil}, {type: "string", name: name, cls: String, onlyif: nil, verify: nil, length: -> do name_size end, value: nil, encoding: nil}, {type: "enum", name: version, cls: typeof(Version::V5.value), onlyif: nil, verify: nil, value: nil, encoding: nil, enum_type: MQTT::Version}, {type: "bitfield", name: 3, cls: MQTT::V5::Connect, onlyif: nil, verify: nil, endian: IO::ByteFormat::BigEndian}, {type: "basic", name: keep_alive_seconds, cls: UInt16, onlyif: nil, verify: nil, value: nil, endian: nil}, {type: "basic", name: properties, cls: MQTT::V5::Properties, onlyif: nil, verify: nil, value: nil}, {type: "basic", name: client_id_size, cls: UInt16, onlyif: nil, verify: nil, value: -> do client_id.bytesize end, endian: nil}, {type: "string", name: client_id, cls: String, onlyif: nil, verify: nil, length: -> do client_id_size end, value: nil, encoding: nil}, {type: "basic", name: will_properties, cls: MQTT::V5::Properties, onlyif: -> do will_flag end, verify: nil, value: nil}, {type: "basic", name: will_topic_size, cls: UInt16, onlyif: -> do will_flag end, verify: nil, value: -> do will_topic.bytesize end, endian: nil}, {type: "string", name: will_topic, cls: String, onlyif: -> do will_flag end, verify: nil, length: -> do will_topic_size end, value: nil, encoding: nil}, {type: "basic", name: will_payload_size, cls: UInt16, onlyif: -> do will_flag end, verify: nil, value: -> do will_payload.size end, endian: nil}, {type: "bytes", name: will_payload, cls: Slice(UInt8), onlyif: -> do will_flag end, verify: nil, length: -> do will_payload_size end, value: nil}, {type: "basic", name: username_size, cls: UInt16, onlyif: -> do has_username end, verify: nil, value: -> do username.bytesize end, endian: nil}, {type: "string", name: username, cls: String, onlyif: -> do has_username end, verify: nil, length: -> do username_size end, value: nil, encoding: nil}, {type: "basic", name: password_size, cls: UInt16, onlyif: -> do has_password end, verify: nil, value: -> do password.bytesize end, endian: nil}, {type: "string", name: password, cls: String, onlyif: -> do has_password end, verify: nil, length: -> do password_size end, value: nil, encoding: nil}] of Nil

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

REMAINING = [] of Nil

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

Class methods

bit_fields

MQTT-3.1. Same shape as 3.1.1 with a property section after the keep alive, and a second property section in front of the will topic

Source

Instance methods

__format__

A group or bit_field captures the endianness at its declaration point, so declaring endian after one would silently leave it system-endian. Fail loudly.

Source
_reserved_
_reserved_=(_reserved_ : UInt8)
add_user_property(key : String, value : String) : Nil
Source
authentication_data
Source
authentication_data=(value : Bytes | Nil)
Source
authentication_method
Source
authentication_method=(value : String | Nil)
Source
calculate_length

Packet length, excluding the fixed header

Source
clean_start
Source
clean_start=(clean_start : UInt8)
clean_start=(value : Bool)
Source
client_id
client_id=(client_id : String)
client_id_size
client_id_size=(client_id_size : UInt16)
has_password
Source
has_password=(has_password : UInt8)
has_password=(value : Bool)
Source
has_username
Source
has_username=(has_username : UInt8)
has_username=(value : Bool)
Source
keep_alive_seconds
keep_alive_seconds=(keep_alive_seconds : UInt16)
maximum_packet_size
Source
maximum_packet_size=(value : UInt32 | Nil)
Source
name
name=(name : String)
name_size
name_size=(name_size : UInt16)
password
password=(str : String)
Source
password_size
password_size=(password_size : UInt16)
properties
properties=(properties : Properties)
receive_maximum

How many QoS > 0 messages we are willing to have in flight at once

Source
receive_maximum=(value : UInt16 | Nil)
Source
session_expiry_interval

How long the broker keeps the session after we disconnect. 5.0 uses this instead of 3.1.1's clean session flag alone

Source
session_expiry_interval=(value : UInt32 | Nil)
Source
topic_alias_maximum
Source
topic_alias_maximum=(value : UInt16 | Nil)
Source
user_properties
Source
username
username=(str : String)
Source
username_size
username_size=(username_size : UInt16)
validate!
Source
version
version=(version : Version)
will_delay_interval

How long the broker waits before publishing the will

Source
will_delay_interval=(value : UInt32 | Nil)
Source
will_flag
Source
will_flag=(will_flag : UInt8)
will_flag=(value : Bool)
Source
will_payload
will_payload=(will_payload : Bytes)
will_payload=(payload : String)
Source
will_payload_size

MQTT-3.1.3.3, the will payload is binary data rather than a string

will_payload_size=(will_payload_size : UInt16)

MQTT-3.1.3.3, the will payload is binary data rather than a string

will_properties

the will has its own property section, and it precedes the will topic

will_properties=(will_properties : Properties)

the will has its own property section, and it precedes the will topic

will_qos
Source
will_qos=(will_qos : UInt8)
will_qos=(value : MQTT::QoS)
Source
will_retain
Source
will_retain=(will_retain : UInt8)
will_retain=(value : Bool)
Source
will_topic
will_topic=(str : String)
Source
will_topic_size
will_topic_size=(will_topic_size : UInt16)