Exemplo n.º 1
0
func setMessageHandlers() {
	ax.OnEnter(onEnter)
	ax.OnLeave(onLeave)
	ax.OnJson("query_tunnel", tunnel.OnQueryTunnel)
	ax.OnJson("enter_tunnel", tunnel.OnEnterTunnel)
	ax.OnJson("leave_tunnel", onLeaveTunnel)
	ax.OnJson("simple_send", tunnel.OnSimpleSend)
}
Exemplo n.º 2
0
Arquivo: main.go Projeto: devhq-io/ax
func setMessageHandlers() {
	ax.OnJson("request",
		func(c *ax.Client, data interface{}) {
			type answerArgs struct {
				Value int `json:"value"`
			}
			value += 1
			log.Printf("request message: '%+v'\n", data)
			c.JsonSend("answer", &answerArgs{Value: value})
		})
}