加入网络层
This commit is contained in:
39
Server/Gateway/app/websocket.go
Normal file
39
Server/Gateway/app/websocket.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"common/log"
|
||||
"common/net/socket/websocket"
|
||||
"gateway/config"
|
||||
"gateway/net/ws_gateway"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (p *Program) initWsServer(cfg *config.Config) error {
|
||||
//p.wsServer = websocket.NewWSServer(
|
||||
// &ws_gateway.GatewayWsServer{
|
||||
// Decoder: &ws_gateway.Decoder{},
|
||||
// },
|
||||
// log.GetLogger(),
|
||||
// fmt.Sprintf("tcp4://%v:%d", cfg.SocketServer.Host, cfg.SocketServer.Port),
|
||||
// true,
|
||||
// true,
|
||||
// false,
|
||||
// false,
|
||||
// true,
|
||||
// 8,
|
||||
// 5*time.Second,
|
||||
//)
|
||||
p.wsServer = websocket.NewWSServer(
|
||||
&ws_gateway.GatewayWsServer{},
|
||||
log.GetLogger(),
|
||||
5*time.Second,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Program) stopWsServer() error {
|
||||
_ = p.wsServer.Stop()
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user