server.go 640 B

123456789101112131415161718192021222324
  1. package grpc
  2. import (
  3. v1pb "go-common/app/service/live/xuser/api/grpc/v1"
  4. "go-common/app/service/live/xuser/dao"
  5. "go-common/app/service/live/xuser/service"
  6. "go-common/library/net/rpc/warden"
  7. )
  8. // New new grpc server
  9. func New(svc *service.Service) (wsvr *warden.Server, err error) {
  10. wsvr = warden.NewServer(nil)
  11. dao.InitAPI()
  12. v1pb.RegisterVipServer(wsvr.Server(), svc.VipV1Svc())
  13. v1pb.RegisterGuardServer(wsvr.Server(), svc.GuardV1Svc())
  14. v1pb.RegisterUserExpServer(wsvr.Server(), svc.ExpV1Svc())
  15. v1pb.RegisterRoomAdminServer(wsvr.Server(), svc.RoomAdminV1Svc())
  16. if wsvr, err = wsvr.Start(); err != nil {
  17. return
  18. }
  19. return
  20. }