iothub icon indicating copy to clipboard operation
iothub copied to clipboard

Support for OnConnection Lister in MQTT transport

Open z-br opened this issue 5 years ago • 0 comments

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.

z-br avatar Jun 01 '20 19:06 z-br