iothub
iothub copied to clipboard
Support for OnConnection Lister in MQTT transport
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.