update
This commit is contained in:
@@ -156,6 +156,7 @@ function mqttClientInstance_v2(
|
||||
keepaliveCheckInterval::Integer=30,
|
||||
qos::MQTTClient.QOS=QOS_1,
|
||||
multiMsg::String="single",
|
||||
clearOldMsg::Bool=true,
|
||||
)
|
||||
|
||||
client, connection = MQTTClient.MakeConnection(mqttBrokerAddress, mqttBrokerPort)
|
||||
@@ -182,6 +183,15 @@ function mqttClientInstance_v2(
|
||||
nothing, # store latest message to prevent doing the same massage twice
|
||||
)
|
||||
|
||||
if clearOldMsg
|
||||
chnames = keys(msgReceiveChannel)
|
||||
for i in chnames
|
||||
while isready(msgReceiveChannel[i])
|
||||
_ = take!(msgReceiveChannel[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user