Skip to content

Commit

Permalink
Update Message docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Mar 1, 2021
1 parent 8f0fee8 commit a41654b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
10 changes: 5 additions & 5 deletions docs/en/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
* MQTT Coroutine Client
* [Client API](en/client)

* MQTT Server
* [Message API](en/message)
* [Client API](en/client)

* MQTT Protocol Analysis
* [Protocol API](en/protocol)
* [Protocol API](en/protocol)

* MQTT Message
* [Message API](en/message)

* Upgrade Guide
* [1.2 Upgrade Guide](en/upgrade/1.2.md)
16 changes: 15 additions & 1 deletion docs/en/message.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Message API

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

## Usage examples

Expand Down Expand Up @@ -30,3 +30,17 @@ $ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0)
$ack_data = $ack->getContents();
$ack_data = (string) $ack;
```

### Server

```php
$server->send($fd, $ack->getContents());
$server->send($fd, (string) $ack);
```

### Client

```php
// Add param to get an array
$client->send($ack->getContents(true), false);
```
10 changes: 5 additions & 5 deletions docs/zh-cn/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
* MQTT 协程客户端
* [Client API](zh-cn/client)

* MQTT Server
* [Message API](zh-cn/message)
* [Client API](zh-cn/client)

* MQTT 协议解析
* [Protocol API](zh-cn/protocol)
* [Protocol API](zh-cn/protocol)

* MQTT Message
* [Message API](zh-cn/message)

* 版本升级指南
* [1.2 升级指南](zh-cn/upgrade/1.2.md)
16 changes: 15 additions & 1 deletion docs/zh-cn/message.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Message API

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

## 使用示例

Expand Down Expand Up @@ -30,3 +30,17 @@ $ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0)
$ack_data = $ack->getContents();
$ack_data = (string) $ack;
```

### Server

```php
$server->send($fd, $ack->getContents());
$server->send($fd, (string) $ack);
```

### Client

```php
// 增加参数来获取数组
$client->send($ack->getContents(true), false);
```

0 comments on commit a41654b

Please sign in to comment.