forked from jshiffer/go-xmpp
Introduce Sender interface to abstract client sending in router handlers
This commit is contained in:
committed by
Mickaël Rémond
parent
b05e68c844
commit
9db33d5792
@@ -19,12 +19,20 @@ import (
|
||||
// permanent errors to avoid useless reconnection loops.
|
||||
// - Metrics processing
|
||||
|
||||
// StreamClient is an interface used by StreamManager to control Client lifecycle,
|
||||
// set callback and trigger reconnection.
|
||||
type StreamClient interface {
|
||||
Connect() error
|
||||
Disconnect()
|
||||
SetHandler(handler EventHandler)
|
||||
}
|
||||
|
||||
// Sender is an interface provided by Stream clients to allow sending XMPP data.
|
||||
type Sender interface {
|
||||
Send(packet Packet) error
|
||||
SendRaw(packet string) error
|
||||
}
|
||||
|
||||
// StreamManager supervises an XMPP client connection. Its role is to handle connection events and
|
||||
// apply reconnection strategy.
|
||||
type StreamManager struct {
|
||||
|
||||
Reference in New Issue
Block a user