3 Commits

Author SHA1 Message Date
d237909b6d Feature laravel 9 (#22)
* Support Laravel 9

* Build and test using PHP 8.1
2022-02-10 19:22:40 +01:00
7dfaac06e4 Fix: Recreate disconnected connections when being retrieved (#19) 2022-01-08 14:23:13 +01:00
9e69fb1e45 Use php-mqtt/client:^1.0 2021-01-10 19:50:26 +01:00
3 changed files with 11 additions and 5 deletions

View File

@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
php-version: ['7.4', '8.0']
php-version: ['7.4', '8.0', '8.1']
steps:
- uses: actions/checkout@v2
@ -55,7 +55,7 @@ jobs:
- name: Run SonarQube analysis
uses: sonarsource/sonarcloud-github-action@master
if: matrix.php-version == '8.0'
if: matrix.php-version == '8.1'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}

View File

@ -20,9 +20,9 @@
],
"require": {
"php": "^7.4|^8.0",
"illuminate/config": "~7.0|~8.0",
"illuminate/support": "~7.0|~8.0",
"php-mqtt/client": "v1.0.0-rc1"
"illuminate/config": "~7.0|~8.0|~9.0",
"illuminate/support": "~7.0|~8.0|~9.0",
"php-mqtt/client": "^1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5"

View File

@ -60,6 +60,12 @@ class ConnectionManager
$name = $this->defaultConnection;
}
// Remove the connection if it is in a disconnected state.
// Doing this instead of simply reconnecting ensures the caller will get a fresh connection.
if (array_key_exists($name, $this->connections) && !$this->connections[$name]->isConnected()) {
unset($this->connections[$name]);
}
if (!array_key_exists($name, $this->connections)) {
$this->connections[$name] = $this->createConnection($name);
}