mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2025-11-22 01:23:47 -08:00
Added callback to process errors after connection.
Added tests and refactored a bit.
This commit is contained in:
@@ -35,7 +35,7 @@ func main() {
|
||||
IQNamespaces("jabber:iq:version").
|
||||
HandlerFunc(handleVersion)
|
||||
|
||||
component, err := xmpp.NewComponent(opts, router)
|
||||
component, err := xmpp.NewComponent(opts, router, handleError)
|
||||
if err != nil {
|
||||
log.Fatalf("%+v", err)
|
||||
}
|
||||
@@ -47,6 +47,10 @@ func main() {
|
||||
log.Fatal(cm.Run())
|
||||
}
|
||||
|
||||
func handleError(err error) {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
||||
func handleMessage(_ xmpp.Sender, p stanza.Packet) {
|
||||
msg, ok := p.(stanza.Message)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user