Beispiel #1
0
func (c *co) OnWatchMessage(request *aaa.Send, genwsc *genws.Connection, session []byte) error {

	var c2request aaa.Send
	c2request = *request
	c2request.GWSRPCID = c.id

	s, err := aaaClient.WatchMessage(context.Background(), &c2request)
	if err != nil {
		grpclog.Printf("aaaClient %v: ", err)
		return err
	}

	for {
		r, err := s.Recv()
		if err == io.EOF {
			break
		} else if err != nil {
			return err
		}
		body, err := proto.Marshal(r)
		if err != nil {
			return err
		}
		genws.RecvGRPC2GWSRPC(genwsc, session, body)
	}

	return nil
}
Beispiel #2
0
func (c *co) OnReg(request *aaa.Send) *aaa.Recv {

	var c2request aaa.Send
	c2request = *request
	c2request.GWSRPCID = c.id

	r, err := aaaClient.Reg(context.Background(), &c2request)
	if err != nil {
		grpclog.Printf("aaaClient %v: ", err)
		return nil
	}

	return r
}