Open z-br opened 4 years ago
Setting the OnConnection listener on the MQTT Transports breaks subscriptions, because the library relies on it, so it is impossible to get notifications about disconnect. For disconnects, it is possible to customize the OnConnectionLost as such:
opts := mqtt.WithClientOptionsConfig(func(opts *paho.ClientOptions) { opts.OnConnectionLost = func(client paho.Client, e error) { onDisconnect(e) } })
It would be nice if there was someway to get OnConnect callbacks.
Setting the OnConnection listener on the MQTT Transports breaks subscriptions, because the library relies on it, so it is impossible to get notifications about disconnect. For disconnects, it is possible to customize the OnConnectionLost as such:
It would be nice if there was someway to get OnConnect callbacks.