func readLoop(client *client.Client) { for { select { case incomingMessage := <-client.Messages(): if args.Verbose { fmt.Println(string(incomingMessage.Bytes())) } else { fmt.Printf("%v: %v\n", incomingMessage.PublisherUserId, incomingMessage.BodyAsString()) } case error := <-client.Errors(): fmt.Println("ERROR: " + string(error.Bytes())) case status := <-client.StatusMessages(): fmt.Println(string(status.Bytes())) fmt.Println() } } }
func readLoop(client client.Client) { for { select { case incomingMessage := <-client.Messages(): if *verbose { fmt.Println(string(incomingMessage.Bytes())) } else { fmt.Printf("%v: %v\n", incomingMessage.UserID, incomingMessage.BodyAsString()) } case e := <-client.Errors(): fmt.Println("ERROR: " + string(e.Bytes())) case status := <-client.StatusMessages(): fmt.Println(string(status.Bytes())) fmt.Println() } } }