Exemplo n.º 1
0
func requestGreet(s *gotalk.Sock, name string) string {
	r := ""
	if err := s.Request("greet", name, &r); err != nil {
		panic("request error: " + err.Error())
	}
	return r
}
Exemplo n.º 2
0
func onAccept(s *gotalk.Sock) {
	s.Notify("hello", "world")
	go func() {
		// Send a request & read result via JSON-encoded go values.
		greeting := GreetOut{}
		if err := s.Request("greet", GreetIn{"Rasmus"}, &greeting); err != nil {
			fmt.Printf("greet request failed: " + err.Error())
		} else {
			fmt.Printf("greet: %+v\n", greeting)
		}
	}()
}