Add auto reconnect support (#31)

* Update mqtt-client.php

* Update ConnectionManager.php

* Update mqtt-client.php

* Update mqtt-client.php

* Update mqtt-client.php

* Update ConnectionManager.php

* Update mqtt-client.php

* Add and normalize auto-reconnect settings

* Add .gitkeep

* Remove .gitkeep

Co-authored-by: Marvin Mall <marvin-mall@msn.com>
This commit is contained in:
iVampireSP.com
2022-11-23 05:26:38 +08:00
committed by GitHub
parent 136ce2cb75
commit fe0cb883e7
2 changed files with 12 additions and 1 deletions

View File

@ -177,6 +177,9 @@ class ConnectionManager
->setLastWillTopic(Arr::get($config, 'last_will.topic'))
->setLastWillMessage(Arr::get($config, 'last_will.message'))
->setLastWillQualityOfService((int) Arr::get($config, 'last_will.quality_of_service', MqttClient::QOS_AT_MOST_ONCE))
->setRetainLastWill((bool) Arr::get($config, 'last_will.retain', false));
->setRetainLastWill((bool) Arr::get($config, 'last_will.retain', false))
->setReconnectAutomatically((bool) Arr::get($config, 'auto_reconnect.enabled', false))
->setMaxReconnectAttempts((int) Arr::get($config, 'auto_reconnect.max_reconnect_attempts', 3))
->setDelayBetweenReconnectAttempts((int) Arr::get($config, 'auto_reconnect.delay_between_reconnect_attempts', 0));
}
}