-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructure.txt
43 lines (40 loc) · 1.12 KB
/
structure.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Control Packet Structure:
1. Fixed header - slice of bytes
2. Variable header - 2 bytes
3. Payload -
Control Packets by client | Methods
1. Connect | Connect
2. Publish | Publish
3. PubAck | AcknowledgedPublish
4. PubRec | ReceivedPublish
5. PubRel | ReleasePublish
6. PubComp | CompletedPublish
7. Subscribe | Subscribe
8. Unsubscribe | Unsubscribe
9. PingReq | Ping
10. Disconnect | Disconnect
CONNECT Packet:
Fixed Header:
_________
Byte-1: 0001|0000|
Byte-2: Remaining Length(len(Variable Header)+len(payload))
Variable Header: -> 10 bytes
Protocol Name - 6 bytes
Protocol Length - 1 byte
Connect Flags - 1 byte
Keep-Alive - 2 bytes
Connect Flags:
0 - Reserved
1 - Clean Session
2 - Will Flag
3
4 - Will Qos
5 - Will Retain
6 - Password
7 - Username
Payload:
ClientId 1-23 bytes
Will Topic
Will Message
Username
Password