Skip to content

Commit a41654b

Browse files
committed
Update Message docs
1 parent 8f0fee8 commit a41654b

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

docs/en/_sidebar.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
* MQTT Coroutine Client
2-
* [Client API](en/client)
3-
4-
* MQTT Server
5-
* [Message API](en/message)
2+
* [Client API](en/client)
63

74
* MQTT Protocol Analysis
8-
* [Protocol API](en/protocol)
5+
* [Protocol API](en/protocol)
6+
7+
* MQTT Message
8+
* [Message API](en/message)
99

1010
* Upgrade Guide
1111
* [1.2 Upgrade Guide](en/upgrade/1.2.md)

docs/en/message.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Message API
22

3-
It is mainly convenient for replying to the ACK on the other side in the Server.
3+
It is mainly convenient for replying to the ACK on the other side in the Server/Client.
44

55
## Usage examples
66

@@ -30,3 +30,17 @@ $ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0)
3030
$ack_data = $ack->getContents();
3131
$ack_data = (string) $ack;
3232
```
33+
34+
### Server
35+
36+
```php
37+
$server->send($fd, $ack->getContents());
38+
$server->send($fd, (string) $ack);
39+
```
40+
41+
### Client
42+
43+
```php
44+
// Add param to get an array
45+
$client->send($ack->getContents(true), false);
46+
```

docs/zh-cn/_sidebar.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
* MQTT 协程客户端
2-
* [Client API](zh-cn/client)
3-
4-
* MQTT Server
5-
* [Message API](zh-cn/message)
2+
* [Client API](zh-cn/client)
63

74
* MQTT 协议解析
8-
* [Protocol API](zh-cn/protocol)
5+
* [Protocol API](zh-cn/protocol)
6+
7+
* MQTT Message
8+
* [Message API](zh-cn/message)
99

1010
* 版本升级指南
1111
* [1.2 升级指南](zh-cn/upgrade/1.2.md)

docs/zh-cn/message.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Message API
22

3-
主要方便用于在 Server 中回复对端 ACK。
3+
主要方便用于在 Server/Client 中回复对端 ACK。
44

55
## 使用示例
66

@@ -30,3 +30,17 @@ $ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0)
3030
$ack_data = $ack->getContents();
3131
$ack_data = (string) $ack;
3232
```
33+
34+
### Server
35+
36+
```php
37+
$server->send($fd, $ack->getContents());
38+
$server->send($fd, (string) $ack);
39+
```
40+
41+
### Client
42+
43+
```php
44+
// 增加参数来获取数组
45+
$client->send($ack->getContents(true), false);
46+
```

0 commit comments

Comments
 (0)