-
-
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.
Merge pull request #29 from simps/develop
Update version for v1.2.0
- Loading branch information
Showing
41 changed files
with
695 additions
and
317 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
} | ||
], | ||
"require": { | ||
"php": ">=7.0", | ||
"php": ">=7.1", | ||
"ext-mbstring": "*" | ||
}, | ||
"require-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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
* MQTT Protocol Analysis | ||
* [Protocol API](en/protocol) | ||
|
||
* Upgrade Guide | ||
* [1.2 Upgrade Guide](en/upgrade/1.2.md) |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# 1.2 Upgrade Guide | ||
|
||
Version 1.2 mainly changes the `__construct` parameters of the Client and the namespace of the Protocol. | ||
|
||
## Protocol | ||
|
||
A new layer of `Protocol` has been added, using `V3` and `V5` to differentiate between MQTT protocol levels. | ||
|
||
Also moved `Simps\MQTT\Types` to `Protocol` as well, changing it to `Simps\MQTT\Protocol\Types`. | ||
|
||
### 1.1 | ||
|
||
```php | ||
Simps\MQTT\Protocol::pack(array $array) | ||
Simps\MQTT\ProtocolV5::pack(array $array) | ||
Simps\MQTT\ProtocolInterface::MQTT_PROTOCOL_LEVEL_3_1; | ||
|
||
Simps\MQTT\Types::CONNECT; | ||
``` | ||
|
||
### 1.2 | ||
|
||
```php | ||
Simps\MQTT\Protocol\V3::pack(array $array) | ||
Simps\MQTT\Protocol\V5::pack(array $array) | ||
Simps\MQTT\Protocol\ProtocolInterface::MQTT_PROTOCOL_LEVEL_3_1; | ||
|
||
Simps\MQTT\Protocol\Types::CONNECT; | ||
``` | ||
|
||
## Client | ||
|
||
Client was previously passing array parameters directly, now it is an object. | ||
|
||
### 1.1 | ||
|
||
```php | ||
use Simps\MQTT\Client; | ||
|
||
$config = [ | ||
'host' => '127.0.0.1', | ||
'port' => 1883, | ||
'user_name' => '', | ||
'password' => '', | ||
'client_id' => Client::genClientID(), | ||
'keep_alive' => 10, | ||
]; | ||
$swooleConfig = [ | ||
'open_mqtt_protocol' => true, | ||
'package_max_length' => 2 * 1024 * 1024, | ||
'connect_timeout' => 1.0, | ||
'write_timeout' => 3.0, | ||
'read_timeout' => 0.5, | ||
]; | ||
$client = new Client($config, $swooleConfig); | ||
``` | ||
|
||
### 1.2 | ||
|
||
```php | ||
use Simps\MQTT\Client; | ||
use Simps\MQTT\Config\ClientConfig; | ||
|
||
$config = new ClientConfig(); | ||
$config->setUserName('') | ||
->setPassword('') | ||
->setClientId(Client::genClientID()) | ||
->setKeepAlive(10); | ||
|
||
$swooleConfig = [ | ||
'open_mqtt_protocol' => true, | ||
'package_max_length' => 2 * 1024 * 1024, | ||
'connect_timeout' => 1.0, | ||
'write_timeout' => 3.0, | ||
'read_timeout' => 0.5, | ||
]; | ||
$config->setSwooleConfig($swooleConfig); | ||
$client = new Client('127.0.0.1', 1883, $config); | ||
|
||
// You can also set it up like this | ||
$config = new ClientConfig([ | ||
'userName' => '', | ||
'password' => '', | ||
'clientId' => '', | ||
'keepAlive' => 10, | ||
'protocolName' => 'MQTT', | ||
'protocolLevel' => 4, | ||
'properties' => [], | ||
'reconnectDelay' => 3, | ||
'swooleConfig' => [] | ||
]); | ||
$client = new Client('127.0.0.1', 1883, $config); | ||
``` |
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
* MQTT 协议解析 | ||
* [Protocol API](zh-cn/protocol) | ||
|
||
* 版本升级指南 | ||
* [1.2 升级指南](zh-cn/upgrade/1.2.md) |
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
Oops, something went wrong.