MQTT协议简介

7月 4, 2023 |

tcpdump -nn -X -i ens33 port 1883
报文格式

bit 7-4 3 2-1 0
byte1 Message Type DUP flag QoS level RETAIN
byte2 Remaining Length

CONNECT(0x1)
control + length + protocol name + Protocol Level +Connect Flags + keep alive +Payload
PUBLISH(3)
control + length + topic(length+name) + Packet identifier + payload
SUBSCRIBE(8)
control + length + Packet identifier + topic(length+name)
PINGREQ(12)
DISCONNECT(14)

参考文档

mqtt-protocol-description

Posted in: 面试加油站

Comments are closed.