class MQTT::V5::Connect

Overview

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

Defined in:

mqtt/v5/connect.cr

Constant Summary

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 Method Summary

Instance Method Summary

Instance methods inherited from class MQTT::Header

__format__ : IO::ByteFormat __format__, duplicate : Bool duplicate, duplicate=(duplicate : UInt8)
duplicate=(value : Bool)
duplicate=
, fixed_header_size : Int32 fixed_header_size, id : MQTT::RequestType id, id=(id : UInt8)
id=(value : MQTT::RequestType)
id=
, packet_length : UInt32 packet_length, packet_length=(size : UInt32) : UInt32 packet_length=, qos : MQTT::QoS qos, qos=(qos : UInt8)
qos=(value : MQTT::QoS)
qos=
, qos? qos?, retain : Bool retain, retain=(retain : UInt8)
retain=(value : Bool)
retain=
, variable_length1 : UInt8 variable_length1, variable_length1=(value : UInt8) : UInt8 variable_length1=, variable_length2 : UInt8 variable_length2, variable_length2=(value : UInt8) : UInt8 variable_length2=, variable_length3 : UInt8 variable_length3, variable_length3=(value : UInt8) : UInt8 variable_length3=, variable_length4 : UInt8 variable_length4, variable_length4=(value : UInt8) : UInt8 variable_length4=

Class methods inherited from class MQTT::Header

bit_fields bit_fields

Class Method Detail

def self.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


[View source]

Instance Method Detail

def __format__ : IO::ByteFormat #

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.


[View source]
def _reserved_ : UInt8 #

def _reserved_=(_reserved_ : UInt8) #

def add_user_property(key : String, value : String) : Nil #

[View source]
def authentication_data : Bytes | Nil #

[View source]
def authentication_data=(value : Bytes | Nil) #

[View source]
def authentication_method : String | Nil #

[View source]
def authentication_method=(value : String | Nil) #

[View source]
def calculate_length : UInt32 #

Packet length, excluding the fixed header


[View source]
def clean_start : Bool #

[View source]
def clean_start=(clean_start : UInt8) #

def clean_start=(value : Bool) #

[View source]
def client_id : String #

def client_id=(client_id : String) #

def client_id_size : UInt16 #

def client_id_size=(client_id_size : UInt16) #

def has_password : Bool #

[View source]
def has_password=(has_password : UInt8) #

def has_password=(value : Bool) #

[View source]
def has_username : Bool #

[View source]
def has_username=(has_username : UInt8) #

def has_username=(value : Bool) #

[View source]
def keep_alive_seconds : UInt16 #

def keep_alive_seconds=(keep_alive_seconds : UInt16) #

def maximum_packet_size : UInt32 | Nil #

[View source]
def maximum_packet_size=(value : UInt32 | Nil) #

[View source]
def name : String #

def name=(name : String) #

def name_size : UInt16 #

def name_size=(name_size : UInt16) #

def password : String #

def password=(str : String) #

[View source]
def password_size : UInt16 #

def password_size=(password_size : UInt16) #

def properties : Properties #

def properties=(properties : Properties) #

def receive_maximum : UInt16 | Nil #

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


[View source]
def receive_maximum=(value : UInt16 | Nil) #

[View source]
def session_expiry_interval : UInt32 | Nil #

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


[View source]
def session_expiry_interval=(value : UInt32 | Nil) #

[View source]
def topic_alias_maximum : UInt16 | Nil #

[View source]
def topic_alias_maximum=(value : UInt16 | Nil) #

[View source]
def user_properties : Array(Tuple(String, String)) #

[View source]
def username : String #

def username=(str : String) #

[View source]
def username_size : UInt16 #

def username_size=(username_size : UInt16) #

def validate! : self #

[View source]
def version : Version #

def version=(version : Version) #

def will_delay_interval : UInt32 | Nil #

How long the broker waits before publishing the will


[View source]
def will_delay_interval=(value : UInt32 | Nil) #

[View source]
def will_flag : Bool #

[View source]
def will_flag=(will_flag : UInt8) #

def will_flag=(value : Bool) #

[View source]
def will_payload : Bytes #

def will_payload=(will_payload : Bytes) #

def will_payload=(payload : String) #

[View source]
def will_payload_size : UInt16 #

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


def will_payload_size=(will_payload_size : UInt16) #

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


def will_properties : Properties #

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


def will_properties=(will_properties : Properties) #

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


def will_qos : MQTT::QoS #

[View source]
def will_qos=(will_qos : UInt8) #

def will_qos=(value : MQTT::QoS) #

[View source]
def will_retain : Bool #

[View source]
def will_retain=(will_retain : UInt8) #

def will_retain=(value : Bool) #

[View source]
def will_topic : String #

def will_topic=(str : String) #

[View source]
def will_topic_size : UInt16 #

def will_topic_size=(will_topic_size : UInt16) #