// read from stdin func read(client *fayeclient.FayeClient) { s := bufio.NewScanner(os.Stdin) for s.Scan() { m := s.Text() fmt.Print("me: " + m + "\n> ") client.Publish("/testing", map[string]interface{}{"message": m}) } if err := s.Err(); err != nil { fmt.Println("error: ", err) return } }
func quit(client *fayeclient.FayeClient) { client.Unsubscribe("/testing") client.Disconnect() os.Exit(0) }