You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the MQTT connection is broken and re-established, the subscriptions are gone. (Just like expected) This means that the client as to re-subscribe to his topics. But as there is no (info) message for this event, there is no option to do so.
My proposal is to have a handle_info(connected, State = #state{mqttc = C, seq = I}) function which is always called after connack, no matter if it is the first connect or a reconnect. Thus this method can be a central point for managing subscriptions.
Alternatively the client could remember the subscriptions and restore them after a reconnect. But I don't think this would be a good idea: Many clients use last-will messages which trigger some stuff and then use on-connected callbacks to indicate to the application that they have regained connection. Therefore a manual connected handling would be preferable IMHO.
The text was updated successfully, but these errors were encountered:
I implemented some crude hack, to have some kind of connection listener: Hades32@e7cc33a (It's my first lines of Erlang, so don't take it to seriuosly ;) ) It's just to illustrate what I'm trying to have.
When the MQTT connection is broken and re-established, the subscriptions are gone. (Just like expected) This means that the client as to re-subscribe to his topics. But as there is no (info) message for this event, there is no option to do so.
My proposal is to have a
handle_info(connected, State = #state{mqttc = C, seq = I})
function which is always called after connack, no matter if it is the first connect or a reconnect. Thus this method can be a central point for managing subscriptions.Alternatively the client could remember the subscriptions and restore them after a reconnect. But I don't think this would be a good idea: Many clients use last-will messages which trigger some stuff and then use on-connected callbacks to indicate to the application that they have regained connection. Therefore a manual connected handling would be preferable IMHO.
The text was updated successfully, but these errors were encountered: