Esempio n. 1
0
// 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
	}
}
Esempio n. 2
0
func quit(client *fayeclient.FayeClient) {
	client.Unsubscribe("/testing")
	client.Disconnect()
	os.Exit(0)
}