-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a2953c
commit b28d880
Showing
7 changed files
with
108 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
* MQTT Coroutine Client | ||
* [Client API](en/client) | ||
* [WebSocket Client API](en/websocket) | ||
- MQTT Coroutine Client | ||
- [Client API](en/client) | ||
- [WebSocket Client API](en/websocket) | ||
|
||
* MQTT Protocol Analysis | ||
* [Protocol API](en/protocol) | ||
- MQTT Protocol Analysis | ||
- [Protocol API](en/protocol) | ||
|
||
* MQTT Message | ||
* [Message API](en/message) | ||
- MQTT Message | ||
- [Message API](en/message) | ||
|
||
* Upgrade Guide | ||
* [1.2 Upgrade Guide](en/upgrade/1.2.md) | ||
- Upgrade Guide | ||
- [1.2 Upgrade Guide](en/upgrade/1.2) | ||
|
||
- Tools | ||
- [Debug Tools](en/debug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Debug Tools | ||
|
||
The tool provides 5 methods for debugging binary data, essentially functioning as a binary data viewer. | ||
|
||
It primarily converts binary data into ASCII or hexadecimal formats for viewing, useful for debugging TCP, WebSocket, UDP, and other protocols. | ||
|
||
```php | ||
public function hexDump(): string // Display in hexadecimal | ||
public function hexDumpAscii(): string // Display in both hexadecimal and corresponding ASCII characters | ||
public function printableText(): string // Printable characters | ||
public function hexStream(): string // Hexadecimal stream | ||
public function ascii(): string // Display in ASCII characters | ||
``` | ||
|
||
You can call these methods statically or instantiate `Simps\MQTT\Tools\Debug` or `Simps\MQTT\Tools\Common`/`Simps\MQTT\Tools\UnPackTool`: | ||
|
||
- Instantiation | ||
|
||
```php | ||
use Simps\MQTT\Tools\Debug; | ||
|
||
$debug = new Debug('0:simps-mqtt/user001/update{ | ||
"msg": "hello, mqtt" | ||
}'); | ||
|
||
//$debug = (new Debug())->setEncode('0:simps-mqtt/user001/update{ | ||
// "msg": "hello, mqtt" | ||
//}'); | ||
|
||
echo $debug->hexDump(), PHP_EOL; | ||
echo $debug->hexDumpAscii(), PHP_EOL; | ||
echo $debug->printableText(), PHP_EOL; | ||
echo $debug->hexStream(), PHP_EOL; | ||
echo $debug->ascii(); | ||
``` | ||
|
||
- Static call | ||
|
||
```php | ||
use Simps\MQTT\Tools\UnPackTool; | ||
|
||
echo UnPackTool::hexDumpAscii('0:simps-mqtt/user001/update{ | ||
"msg": "hello, mqtt" | ||
}'); | ||
``` | ||
|
||
```text | ||
00000000 30 3a 73 69 6d 70 73 2d 6d 71 74 74 2f 75 73 65 0:simps-mqtt/use | ||
00000010 72 30 30 31 2f 75 70 64 61 74 65 7b 0a 20 20 22 r001/update{. " | ||
00000020 6d 73 67 22 3a 20 22 68 65 6c 6c 6f 2c 20 6d 71 msg": "hello, mq | ||
00000030 74 74 22 0a 7d tt".} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
* MQTT 协程客户端 | ||
* [Client API](zh-cn/client) | ||
* [WebSocket Client API](zh-cn/websocket) | ||
- MQTT 协程客户端 | ||
- [Client API](zh-cn/client) | ||
- [WebSocket Client API](zh-cn/websocket) | ||
|
||
* MQTT 协议解析 | ||
* [Protocol API](zh-cn/protocol) | ||
- MQTT 协议解析 | ||
- [Protocol API](zh-cn/protocol) | ||
|
||
* MQTT Message | ||
* [Message API](zh-cn/message) | ||
- MQTT Message | ||
- [Message API](zh-cn/message) | ||
|
||
* 版本升级指南 | ||
* [1.2 升级指南](zh-cn/upgrade/1.2.md) | ||
- 版本升级指南 | ||
- [1.2 升级指南](zh-cn/upgrade/1.2) | ||
|
||
* Tools | ||
|
||
- [Debug Tools](zh-cn/debug.md) | ||
- [自适应协议等级](zh-cn/level.md) | ||
- Tools | ||
- [Debug Tools](zh-cn/debug) | ||
- [自适应协议等级](zh-cn/level) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters