package grpc_server import ( "git.hlsq.asia/mmorpg/service-common/discover/common" "git.hlsq.asia/mmorpg/service-common/net/grpc/service" "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb" "git.hlsq.asia/mmorpg/service-gateway/internal/handler/ws_handler/client" "google.golang.org/grpc" ) type Server struct { grpc_pb.UnimplementedGatewayServer service.Base } func NewServer(ttl int64) *Server { s := &Server{ Base: service.Base{ Target: common.KeyDiscoverGateway, ServiceName: common.KeyDiscoverServiceNameGateway, EtcdTTL: ttl, }, } s.Base.OnInit = s.OnInit s.Base.OnClose = s.OnClose return s } func (s *Server) OnInit(serve *grpc.Server) { client.GatewaySID = s.SID grpc_pb.RegisterGatewayServer(serve, s) } func (s *Server) OnClose() { }