overflow_gateway_websocket/server/server.go
crusader e5a491c6bb ing
2017-11-14 15:02:42 +09:00

35 lines
865 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) Server {
if nil == config.Config.Server {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized"))
}
shs := sh.(*ServerHandlers)
shs.Name = config.Config.Server.Name
shs.Concurrency = config.Config.Server.Concurrency
shs.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime
shs.HandshakeTimeout = config.Config.Websocket.HandshakeTimeout
shs.ReadBufferSize = config.Config.Websocket.ReadBufferSize
shs.WriteBufferSize = config.Config.Websocket.WriteBufferSize
shs.EnableCompression = config.Config.Websocket.EnableCompression
s := cwf.New(shs)
return s
}
type Server interface {
cwf.Server
}