overflow_gateway_websocket/server/server.go

29 lines
792 B
Go
Raw Normal View History

2017-11-10 13:24:10 +00:00
package server
import (
2017-11-14 03:03:16 +00:00
"fmt"
2017-11-10 13:24:10 +00:00
2017-11-14 03:03:16 +00:00
"git.loafle.net/commons_go/logging"
cwf "git.loafle.net/commons_go/websocket_fasthttp"
2017-11-10 13:24:10 +00:00
"git.loafle.net/overflow/overflow_gateway_websocket/config"
)
2017-11-14 03:03:16 +00:00
func New(sh ServerHandler) cwf.Server {
if nil == config.Config.Server {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized"))
}
2017-11-10 13:24:10 +00:00
2017-11-14 03:03:16 +00:00
sh.Name = config.Config.Server.Name
sh.Concurrency = config.Config.Server.Concurrency
sh.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime
2017-11-10 13:24:10 +00:00
2017-11-14 03:03:16 +00:00
sh.HandshakeTimeout = config.Config.Websocket.HandshakeTimeout
sh.ReadBufferSize = config.Config.Websocket.ReadBufferSize
sh.WriteBufferSize = config.Config.Websocket.WriteBufferSize
sh.EnableCompression = config.Config.Websocket.EnableCompression
s := cwf.New(sh)
return s
2017-11-10 13:24:10 +00:00
}