Пример #1
0
func (s *Server) BiRPCRegister(rcvr interface{}) {
	if s.birpcSrv == nil {
		s.birpcSrv = rpc2.NewServer()
	}
	rcvType := reflect.TypeOf(rcvr)
	for i := 0; i < rcvType.NumMethod(); i++ {
		method := rcvType.Method(i)
		if method.Name != "Call" {
			s.birpcSrv.Handle("SMGenericV1."+method.Name, method.Func.Interface())
		}
	}
}
Пример #2
0
// Registers a new BiJsonRpc name
func (s *Server) BiRPCRegisterName(method string, handlerFunc interface{}) {
	if s.birpcSrv == nil {
		s.birpcSrv = rpc2.NewServer()
	}
	s.birpcSrv.Handle(method, handlerFunc)
}