-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtypes.go
More file actions
24 lines (19 loc) · 830 Bytes
/
types.go
File metadata and controls
24 lines (19 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package courier
import (
"context"
)
// OnConnectHandler is a callback that is called when the client
// state changes from disconnected to connected. Both
// at initial connection and on reconnection
type OnConnectHandler func(PubSub)
// OnConnectionLostHandler is a callback type which can be set to be
// executed upon an unintended disconnection from the MQTT broker.
// Disconnects caused by calling Disconnect or ForceDisconnect will
// not cause an WithOnConnectionLost callback to execute.
type OnConnectionLostHandler func(error)
// OnReconnectHandler is invoked prior to reconnecting after
// the initial connection is lost
type OnReconnectHandler func(PubSub)
// MessageHandler is the type that all callbacks being passed
// to Subscriber must satisfy.
type MessageHandler func(context.Context, PubSub, *Message)