This repository has been archived on 2026-01-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Game/Server/gateway/internal/grpc_server/server/server_init.go

35 lines
603 B
Go

package server
import (
"common/discover/common"
"common/net/grpc/service"
"common/proto/ss/grpc_pb"
"gateway/internal/handler/ws_handler"
"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,
EtcdTTL: ttl,
},
}
s.Base.OnInit = s.OnInit
s.Base.OnClose = s.OnClose
return s
}
func (s *Server) OnInit(serve *grpc.Server) {
ws_handler.GatewaySID = s.SID
grpc_pb.RegisterGatewayServer(serve, s)
}
func (s *Server) OnClose() {
}