Closed
Description
The common use case of the library is as follows (adapted from #163 (comment)):
while True:
temperature = dps310.temperature
mqtt_client.publish("foo", temperature)
try:
mqtt_client.loop()
except (MMQTTException) as e:
print("MQTTException: \n", e)
time.sleep(300)
continue
The documentation of the MMQTTException
does not give any advice as to what to do if the exception is raised. Usually, the safest thing would be to reconnect()
on the exception, notably because as indicated on #175 (comment) the message data could be partially read and lost when the exception is raised which would result in garbage on the next read.
There are two choices:
- easy: augment the
MMQTTException
docstring to say areconnect()
is needed upon catching it - more difficult: to allow for the graceful handling of the read timeout, the buffer should be kept around so that message reassembly can be performed
Metadata
Metadata
Assignees
Labels
No labels