class

MqttCrystal::Packet

Inherits Reference / Object

Constants

PACKET_TYPES = [nil, Packet::Connect, Packet::Connack, Packet::Publish, Packet::Puback, Packet::Pubrec, Packet::Pubrel, Packet::Pubcomp, Packet::Subscribe, Packet::Suback, Packet::Unsubscribe, Packet::Unsuback, Packet::Pingreq, Packet::Pingresp, Packet::Disconnect, nil]

Constructors

new(flags : Array(Bool) = [false, false, false, false], body_length : UInt64 = 0_u64)
Source

Class methods

create_from_header(byte : UInt8)
Source
parse(bytes : Array(UInt8)) : Packet | Nil
Source
slice_it(a : String) : Bytes
Source
slice_it(a : Array(UInt8)) : Bytes
Source

Instance methods

_extract_string!(buffer : Array(UInt8), index : Int32 = 0) : String
Source
body_length
Source
body_length=(body_length : UInt64)
Source
bytes
Source
check_remaining_length(bytes : Array(UInt8)) : NamedTuple(pos: UInt8, body_length: UInt64)
Source
concatenate(*args) : Bytes
Source
decode_short(buffer : Array(UInt8), index : Int32) : UInt16
Source
encode_body
Source
encode_header
Source
encode_short(n : UInt16) : Bytes
Source
encode_string(str : String) : Bytes
Source
encode_string(strings : Array(String)) : Bytes
Source
flags
Source
flags=(flags : Array(Bool))
Source
parse_body(buffer : Array(UInt8))
Source
slice_it(a : Array(UInt8)) : Bytes
Source
type_id
Source
validate_flags
Source

Nested types