class

MQTT::V3::Connect

Inherits MQTT::Header / BinData / Reference / Object

Class representing an MQTT Connect Packet

Constants

AFTER_DESERIALIZE = [] of Nil

Class representing an MQTT Connect Packet

BEFORE_SERIALIZE = [] of Nil

Class representing an MQTT Connect Packet

ENDIAN = ["big"]

Class representing an MQTT Connect Packet

KLASS_NAME = [MQTT::V3::Connect]

Class representing an MQTT Connect Packet

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::V311.value), onlyif: nil, verify: nil, value: nil, encoding: nil, enum_type: MQTT::Version}, {type: "bitfield", name: 2, cls: MQTT::V3::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: 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_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.bytesize end, endian: nil}, {type: "string", name: will_payload, cls: String, onlyif: -> do will_flag end, verify: nil, length: -> do will_payload_size end, value: nil, encoding: 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

Class representing an MQTT Connect Packet

REMAINING = [] of Nil

Class representing an MQTT Connect Packet

Class methods

bit_fields

Class representing an MQTT Connect Packet

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)
calculate_length

Packet length, excluding header

Source
clean_start

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/

Source
clean_start=(clean_start : UInt8)

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/

clean_start=(value : Bool)

Set to false to keep a persistent session with the server http://www.steves-internet-guide.com/mqtt-clean-sessions-example/

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)
name
name=(name : String)
name_size
name_size=(name_size : UInt16)
password
password=(str : String)
Source
password_size
password_size=(password_size : UInt16)
username
username=(str : String)
Source
username_size
username_size=(username_size : UInt16)
version

The version number of the protocol

version=(version : Version)

The version number of the protocol

will_flag

flag to indicate if the will topic will be set

Source
will_flag=(will_flag : UInt8)

flag to indicate if the will topic will be set

will_flag=(value : Bool)

flag to indicate if the will topic will be set

Source
will_payload
will_payload=(will_payload : String)
will_payload=(payload : Bytes)

Will payloads are arbitrary bytes, the field is only typed as a string because that is how it's length prefixed on the wire

Source
will_payload_size
will_payload_size=(will_payload_size : UInt16)
will_qos

The QoS level to send the Will message as

Source
will_qos=(will_qos : UInt8)

The QoS level to send the Will message as

will_qos=(value : MQTT::QoS)

The QoS level to send the Will message as

Source
will_retain

Set to true to make the Will message retained

Source
will_retain=(will_retain : UInt8)

Set to true to make the Will message retained

will_retain=(value : Bool)

Set to true to make the Will message retained

Source
will_topic
will_topic=(str : String)
Source
will_topic_size
will_topic_size=(will_topic_size : UInt16)