struct Publish

Overview

Fixed header for PUBLISH PACKET

7 3 0

+--------------------------+--------------------------+

| PUBLISH (3) NIBBLE | DUP(1), QoS(2), Retain(1)| 0

+--------------------------+--------------------------+

| Remaining Len = Len of Variable header + Payload | 1

+-----------------------------------------------------+

Variable header ( LENGTH = 2 Bytes)

+--------------------------+--------------------------+

| TOPIC Name Length MSB (VALUE = 0) | 2

+-----------------------------------------------------+

+--------------------------+--------------------------+

| TOPIC Name Length LSB (VALUE = 4) | 3

+-----------------------------------------------------+

TOPIC

Payload: Set these optionals

+--------------------------+--------------------------+

| Packet Identifier MSB | n

+-----------------------------------------------------+

+--------------------------+--------------------------+

| Packet Identifier LSB | n + 1

+-----------------------------------------------------+

Application payload

Defined in:

crymq/mqtt.cr

Constructors

Instance Method Summary

Instance methods inherited from struct Control

write_mqtt_string(io : IO, s : String) write_mqtt_string, write_remaining_length(io : IO, remaining_len) write_remaining_length

Constructor methods inherited from struct Control

new new

Constructor Detail

def self.new(topic : String, qos : QoS, payload : Slice(UInt8), pkid : Pkid, retain : Bool = false, dup : Bool = false) #

[View source]

Instance Method Detail

def pkid : Pkid #

[View source]
def pkid=(pkid : Pkid) #

[View source]
def to_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) #

[View source]