# 3.4 PUBACK –发布确认

PUBACK报文是对QoS 1等级的PUBLISH报文的响应。

## 3.4.1 固定报头

### 图例 3.12 - PUBACK报文固定报头

| **Bit**   | **7**        | **6** | **5** | **4** | **3** | **2** | **1** | **0** |
| --------- | ------------ | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| byte 1    | MQTT报文类型 (4) | 保留位   |       |       |       |       |       |       |
|           | 0            | 1     | 0     | 0     | 0     | 0     | 0     | 0     |
| byte 2... | 剩余长度         |       |       |       |       |       |       |       |
|           | 0            | 0     | 0     | 0     | 0     | 0     | 1     | 0     |

**剩余长度字段**

表示可变报头的长度。对PUBACK报文这个值等于2.

## 3.4.2 可变报头

包含等待确认的PUBLISH报文的报文标识符。

### 图例 3.13 – PUBACK报文可变报头

| **Bit** | **7**     | **6** | **5** | **4** | **3** | **2** | **1** | **0** |
| ------- | --------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| byte 1  | 报文标识符 MSB |       |       |       |       |       |       |       |
| byte 2  | 报文标识符 LSB |       |       |       |       |       |       |       |

## 3.4.3 有效载荷

PUBACK报文没有有效载荷。

## 3.4.4 动作

完整的描述见 4.3.2节。

## 第三章目录 MQTT控制报文

* [3.0 Contents – MQTT控制报文](/mqtt/03-controlpackets.md)
* [3.1 CONNECT – 连接服务端](/mqtt/03-controlpackets/0301-connect.md)
* [3.2 CONNACK – 确认连接请求](/mqtt/03-controlpackets/0302-connack.md)
* [3.3 PUBLISH – 发布消息](/mqtt/03-controlpackets/0303-publish.md)
* [3.4 PUBACK –发布确认](/mqtt/03-controlpackets/0304-puback.md)
* [3.5 PUBREC – 发布收到（QoS 2，第一步）](/mqtt/03-controlpackets/0305-pubrec.md)
* [3.6 PUBREL – 发布释放（QoS 2，第二步）](/mqtt/03-controlpackets/0306-pubrel.md)
* [3.7 PUBCOMP – 发布完成（QoS 2，第三步）](/mqtt/03-controlpackets/0307-pubcomp.md)
* [3.8 SUBSCRIBE - 订阅主题](/mqtt/03-controlpackets/0308-subscribe.md)
* [3.9 SUBACK – 订阅确认](/mqtt/03-controlpackets/0309-suback.md)
* [3.10 UNSUBSCRIBE –取消订阅](/mqtt/03-controlpackets/0310-unsubscribe.md)
* [3.11 UNSUBACK – 取消订阅确认](/mqtt/03-controlpackets/0311-unsuback.md)
* [3.12 PINGREQ – 心跳请求](/mqtt/03-controlpackets/0312-pingreq.md)
* [3.13 PINGRESP – 心跳响应](/mqtt/03-controlpackets/0313-pingresp.md)
* [3.14 DISCONNECT –断开连接](/mqtt/03-controlpackets/0314-disconnect.md)

## 项目主页

* [MQTT协议中文版](https://github.com/mcxiaoke/mqtt)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mcxiaoke.gitbook.io/mqtt/03-controlpackets/0304-puback.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
