Listen for XMPP connection status changes, and print them out.
--- a/example/interact.go Sun Sep 29 21:37:14 2013 -0600
+++ b/example/interact.go Sun Sep 29 21:54:38 2013 -0600
@@ -41,8 +41,14 @@
os.Exit(2)
}
+ stat := make(chan xmpp.Status)
+ go func() {
+ for s := range stat {
+ log.Printf("connection status %d", s)
+ }
+ }()
tlsConf := tls.Config{InsecureSkipVerify: true}
- c, err := xmpp.NewClient(&jid, *pw, tlsConf, nil, xmpp.Presence{}, nil)
+ c, err := xmpp.NewClient(&jid, *pw, tlsConf, nil, xmpp.Presence{}, stat)
if err != nil {
log.Fatalf("NewClient(%v): %v", jid, err)
}