An octet is just a collection of 8 bit so just another name for a byte
So a message consists of a header made up of 2 or 4 bytes and the the message body.
The header is sub divided into 1 OR 3 bytes for the length and 1 byte for the type. If the first byte is 0x01 then the next 2 bytes are the length, else the value of the first byte is the length.
The next byte is a type, a table of valid message types can be found in sections 5.2.2 in the spec
The Message body varies depending on the type.
But to publish a message with payload HelloWorld
on Topic ID of AB (0x41, 0x42) would look something like this:
0x0F - length (15 bytes total, including length)
0x0C - msg type (publish)
0x02 - flags (QOS 0, topic name)
0x41 - topic ID 1
0x42 - topic ID 2
0x00 - MsgID (00 for QOS 0)
0x48 - H
0x65 - e
0x6C - l
0x6C - l
0x6F - o
0x57 - W
0x6F - o
0x72 - r
0x6C - l
0x64 - d
Where the topic id is the output from a topic register message (Section 6.5 in the spec)