Start reading from the recv channel earlier.
--- a/example/interact.go Mon Sep 09 04:16:16 2013 +0100
+++ b/example/interact.go Mon Sep 09 04:17:06 2013 +0100
@@ -52,6 +52,13 @@
}
defer close(c.Send)
+ go func(ch <-chan xmpp.Stanza) {
+ for obj := range ch {
+ fmt.Printf("s: %v\n", obj)
+ }
+ fmt.Println("done reading")
+ }(c.Recv)
+
err = c.StartSession(&xmpp.Presence{})
if err != nil {
log.Fatalf("StartSession: %v", err)
@@ -63,13 +70,6 @@
fmt.Printf("%d: %v\n", i, entry)
}
- go func(ch <-chan xmpp.Stanza) {
- for obj := range ch {
- fmt.Printf("s: %v\n", obj)
- }
- fmt.Println("done reading")
- }(c.Recv)
-
p := make([]byte, 1024)
for {
nr, _ := os.Stdin.Read(p)