完善服务器
This commit is contained in:
@@ -5,9 +5,7 @@ import (
|
||||
"common/discover"
|
||||
"common/log"
|
||||
"common/net/grpc/service"
|
||||
"common/net/socket/websocket"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/judwhite/go-svc"
|
||||
"runtime/debug"
|
||||
"scene/config"
|
||||
@@ -16,11 +14,9 @@ import (
|
||||
)
|
||||
|
||||
type Program struct {
|
||||
wg *sync.WaitGroup
|
||||
server service.IService // grpc服务
|
||||
webServer *gin.Engine // web服务
|
||||
wsServer *websocket.WSServer // websocket服务
|
||||
stop chan bool
|
||||
wg *sync.WaitGroup
|
||||
server service.IService // grpc服务
|
||||
stop chan bool
|
||||
}
|
||||
|
||||
func (p *Program) Init(_ svc.Environment) error {
|
||||
@@ -47,14 +43,6 @@ func (p *Program) Start() error {
|
||||
discover.Listen()
|
||||
p.server = grpc_server.NewServer(config.Get().Serve.Grpc.TTL)
|
||||
p.server.Init(config.Get().Serve.Grpc.Address, config.Get().Serve.Grpc.Port)
|
||||
go func() {
|
||||
cfg := config.Get()
|
||||
_ = p.wsServer.Run(
|
||||
log.GetLogger().Named("gnet"),
|
||||
fmt.Sprintf("tcp4://0.0.0.0:%v", cfg.Serve.Socket.Web.Port),
|
||||
true, true, false, false, true, 8,
|
||||
)
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user