-
-
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
5cc7ef3
commit d1a01fb
Showing
24 changed files
with
1,429 additions
and
353 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
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
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 |
---|---|---|
|
@@ -55,7 +55,7 @@ | |
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.x-dev" | ||
"dev-master": "2.x-dev" | ||
} | ||
} | ||
} |
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
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,11 +1,15 @@ | ||
* MQTT Coroutine Client | ||
* [Client API](en/client) | ||
- 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".} | ||
``` |
Oops, something went wrong.