예제 #1
0
func (this *Protocol) Deal(client *Client, obj tbs.Message) {
	cmd := obj["cmd"]
	fmt.Printf("cmd[%d]\n", int(cmd.(float64)))
	body := obj["body"]
	_, err := tbs.Call(this, fmt.Sprintf("Deal%d", int(cmd.(float64))), client, body)
	if err != nil {
		fmt.Println(err)
	}
}
예제 #2
0
func (p *Protocol) Deal(client *Client, bytes []byte) {

	buffer := tbs.CreateByteArray(bytes)

	cmd, _ := buffer.ReadInt32()
	fmt.Printf("cmd[%d], len[%d]\n", cmd, len(bytes))
	_, err := tbs.Call(p, fmt.Sprintf("Deal%d", cmd), client, buffer)
	if err != nil {
		fmt.Println(err)
	}
}