alt/services/api/internal/socket/server.go

14 lines
460 B
Go

package socket
import (
protoSocket "git.toki-labs.com/toki/proto-socket/go"
"nhooyr.io/websocket"
"git.toki-labs.com/toki/alt/services/api/internal/config"
)
func NewServer(cfg config.Config) *protoSocket.WsServer {
return protoSocket.NewWsServer(cfg.Host, cfg.Port, cfg.SocketPath, func(conn *websocket.Conn) *protoSocket.WsClient {
return protoSocket.NewWsClient(conn, cfg.HeartbeatIntervalSec, cfg.HeartbeatWaitSec, protoSocket.ParserMap{})
})
}