@@ -44,16 +44,9 @@ type ConnectionLostHandler func(Client, error)
44
44
// at initial connection and on reconnection
45
45
type OnConnectHandler func (Client )
46
46
47
- // WillReconnectArgs contains parameters relating to reconnection
48
- type WillReconnectArgs struct {
49
- // Options points to the current client options. You may want
50
- // to update authentication credentials etc prior to reconnection attempt
51
- Options * ClientOptions
52
- }
53
-
54
- // WillReconnectHandler is invoked prior to a reconnecting after
47
+ // ReconnectHandler is invoked prior to reconnecting after
55
48
// the initial connection is lost
56
- type WillReconnectHandler func (Client , WillReconnectArgs )
49
+ type ReconnectHandler func (Client , * ClientOptions )
57
50
58
51
// ClientOptions contains configurable options for an Client.
59
52
type ClientOptions struct {
@@ -81,7 +74,7 @@ type ClientOptions struct {
81
74
DefaultPublishHandler MessageHandler
82
75
OnConnect OnConnectHandler
83
76
OnConnectionLost ConnectionLostHandler
84
- OnWillReconnect WillReconnectHandler
77
+ OnReconnecting ReconnectHandler
85
78
WriteTimeout time.Duration
86
79
MessageChannelDepth uint
87
80
ResumeSubs bool
@@ -305,10 +298,10 @@ func (o *ClientOptions) SetConnectionLostHandler(onLost ConnectionLostHandler) *
305
298
return o
306
299
}
307
300
308
- // SetWillReconnectHandler will set the OnWillReconnect callback to be executed prior
309
- // to the client attempting a reconnect to the MQTT brokers .
310
- func (o * ClientOptions ) SetWillReconnectHandler ( onWillReconnect WillReconnectHandler ) * ClientOptions {
311
- o .OnWillReconnect = onWillReconnect
301
+ // SetReconnectingHandler sets the OnReconnecting callback to be executed prior
302
+ // to the client attempting a reconnect to the MQTT broker .
303
+ func (o * ClientOptions ) SetReconnectingHandler ( cb ReconnectHandler ) * ClientOptions {
304
+ o .OnReconnecting = cb
312
305
return o
313
306
}
314
307
0 commit comments