-
-
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
a7ba577
commit bab2297
Showing
4 changed files
with
70 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Message API | ||
|
||
It is mainly convenient for replying to the ACK on the other side in the Server. | ||
|
||
## Usage examples | ||
|
||
```php | ||
use Simps\MQTT\Message\SubAck; | ||
use Simps\MQTT\Protocol\ProtocolInterface; | ||
|
||
$codes = [0]; | ||
$message_id = 8520; | ||
|
||
$ack = new SubAck(); | ||
$ack->setCodes($codes) | ||
->setMessageId($message_id); | ||
|
||
$ack_data = $ack->getContents(); | ||
$ack_data = (string) $ack; | ||
|
||
// MQTT5 | ||
$ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0) | ||
->setCodes($codes) | ||
->setMessageId($message_id) | ||
->setProperties([ | ||
'will_delay_interval' => 60, | ||
'message_expiry_interval' => 60, | ||
]); | ||
|
||
$ack_data = $ack->getContents(); | ||
$ack_data = (string) $ack; | ||
``` |
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,32 @@ | ||
# Message API | ||
|
||
主要方便用于在 Server 中回复对端 ACK。 | ||
|
||
## 使用示例 | ||
|
||
```php | ||
use Simps\MQTT\Message\SubAck; | ||
use Simps\MQTT\Protocol\ProtocolInterface; | ||
|
||
$codes = [0]; | ||
$message_id = 8520; | ||
|
||
$ack = new SubAck(); | ||
$ack->setCodes($codes) | ||
->setMessageId($message_id); | ||
|
||
$ack_data = $ack->getContents(); | ||
$ack_data = (string) $ack; | ||
|
||
// MQTT5 | ||
$ack->setProtocolLevel(ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0) | ||
->setCodes($codes) | ||
->setMessageId($message_id) | ||
->setProperties([ | ||
'will_delay_interval' => 60, | ||
'message_expiry_interval' => 60, | ||
]); | ||
|
||
$ack_data = $ack->getContents(); | ||
$ack_data = (string) $ack; | ||
``` |