27 lines
616 B
Go
27 lines
616 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.loafle.net/commons_go/config"
|
|
"git.loafle.net/commons_go/logging"
|
|
ogw "git.loafle.net/overflow/overflow_gateway_websocket"
|
|
)
|
|
|
|
func NewServer(ctx context.Context) ogw.Server {
|
|
h := &serverHandlers{
|
|
ctx: ctx,
|
|
logger: logging.WithContext(ctx),
|
|
}
|
|
h.cfg = config.Sub("websocket")
|
|
h.HandshakeTimeout = h.cfg.GetDuration("HandshakeTimeout") * time.Second
|
|
h.ReadBufferSize = h.cfg.GetInt("ReadBufferSize")
|
|
h.WriteBufferSize = h.cfg.GetInt("WriteBufferSize")
|
|
h.EnableCompression = h.cfg.GetBool("EnableCompression")
|
|
|
|
s := ogw.NewServer(ctx, h)
|
|
|
|
return s
|
|
}
|