Added callback to process errors after connection.

Added tests and refactored a bit.
This commit is contained in:
CORNIERE Rémi
2019-12-05 18:12:00 +01:00
committed by rcorniere
parent 6a3833b27d
commit 5eff2d7623
10 changed files with 795 additions and 334 deletions

View File

@@ -28,7 +28,7 @@ func main() {
router := xmpp.NewRouter()
router.HandleFunc("message", handleMessage)
client, err := xmpp.NewClient(config, router)
client, err := xmpp.NewClient(config, router, errorHandler)
if err != nil {
log.Fatalf("%+v", err)
}
@@ -39,6 +39,10 @@ func main() {
log.Fatal(cm.Run())
}
func errorHandler(err error) {
fmt.Println(err.Error())
}
func handleMessage(s xmpp.Sender, p stanza.Packet) {
msg, ok := p.(stanza.Message)
if !ok {