config has been changed.

This commit is contained in:
crusader
2017-09-19 17:28:21 +09:00
parent 918775c49b
commit 0bc87ebdc5
11 changed files with 71 additions and 85 deletions

View File

@@ -4,28 +4,29 @@ import (
"context"
"time"
"git.loafle.net/commons_go/config"
"git.loafle.net/overflow/overflow_gateway_web/conf"
ogw "git.loafle.net/overflow/overflow_gateway_websocket"
)
type webSocketHandlers struct {
ogw.SocketHandlers
ctx context.Context
cfg config.Configurator
}
func NewWebSocketHandler(ctx context.Context) ogw.SocketHandler {
h := &webSocketHandlers{
ctx: ctx,
}
h.cfg = config.Sub("handlers.web")
h.MaxMessageSize = h.cfg.GetInt64("socket.MaxMessageSize")
h.WriteTimeout = h.cfg.GetDuration("socket.WriteTimeout") * time.Second
h.ReadTimeout = h.cfg.GetDuration("socket.ReadTimeout") * time.Second
h.PongTimeout = h.cfg.GetDuration("socket.PongTimeout") * time.Second
h.PingTimeout = h.cfg.GetDuration("socket.PingTimeout") * time.Second
h.PingPeriod = h.cfg.GetDuration("socket.PingPeriod") * time.Second
h.BinaryMessage = h.cfg.GetBool("socket.BinaryMessage")
cfg := conf.Config.Handlers["web"]
h.MaxMessageSize = cfg.Socket.MaxMessageSize
h.WriteTimeout = cfg.Socket.WriteTimeout * time.Second
h.ReadTimeout = cfg.Socket.ReadTimeout * time.Second
h.PongTimeout = cfg.Socket.PongTimeout * time.Second
h.PingTimeout = cfg.Socket.PingTimeout * time.Second
h.PingPeriod = cfg.Socket.PingPeriod * time.Second
h.BinaryMessage = cfg.Socket.BinaryMessage
ph := newWebJSONRpcHandler(ctx)