br-automation-com/PahoMQTT_Library

automaticReconnect

Closed this issue · 1 comments

Dear,
Correct me if i am wrong.
Like PahoMQTT_Library is based on

https://github.com/eclipse/paho.mqtt.c, Release version 1.2.0

where automaticReconnect is handled
How to use this feature with PahoMQTT_Library.
I do not find where this is availabe in connections options ?
Regards

Hi @stephb59 sorry for the extremly late reply, we moved this library over to
https://github.com/br-automation-com/paho.mqtt.c-ar/
with a brand new port of the eclipse/paho (which is easier update to new versions)
If you have the possibility, use the IotMqtt function block library, because there the connections are easier to handle, and the reconnection settings should also be part of the Client settings

IotMqttClientParType : 	STRUCT 
    ServerUri : STRING[255]; (*String containing broker's URI*)
    Port : UINT := 1883; (*TCP port number used to connect to MQTT broker*)
    ClientID : STRING[255]; (*String containing ClientID. Must be unique inside the broker*)
    UserName : STRING[255]; (*String. MQTT servers that support the MQTT v3.1 protocol provide authentication and authorisation by user name and password. This is the user name parameter*)
    Password : STRING[255]; (*String. MQTT servers that support the MQTT v3.1 protocol provide authentication and authorisation by user name and password. This is the password parameter*)
    KeepAliveInterval : TIME := T#30s; (*The "keep alive" interval, defines the maximum time
that should pass without communication between the client and the server
The client will ensure that at least one message travels across the
network within each keep alive period.  In the absence of a data-related
message during the time period, the client sends a very small MQTT
"ping" message, which the server will acknowledge. The keep alive
interval enables the client to detect when the server is no longer
available without having to wait for the long TCP/IP timeout.
Set to 0 if you do not want any keep alive processing.*)
    LastWill : IotMqttClientParLastWillType; (*LastWill is enabled when the Topic Pointer is set*)
    ConnectTimeout : TIME; (*The time interval to allow a connect to complete*)
    MaxInFlight : UINT; (*This controls how many messages can be in-flight simultaneously.*)
    MinRetryInterval : TIME; (*Minimum retry interval .  Doubled on each failed retry*)
    MaxRetryInterval : TIME; (*Maximum retry interval .  The doubling stops here on failed retries.*)