overflow_gateway_websocket/server/server.go
crusader 2f70541870 ing
2017-11-14 12:03:16 +09:00

29 lines
792 B
Go

package server
import (
"fmt"
"git.loafle.net/commons_go/logging"
cwf "git.loafle.net/commons_go/websocket_fasthttp"
"git.loafle.net/overflow/overflow_gateway_websocket/config"
)
func New(sh ServerHandler) cwf.Server {
if nil == config.Config.Server {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized"))
}
sh.Name = config.Config.Server.Name
sh.Concurrency = config.Config.Server.Concurrency
sh.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime
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
}