27 lines
622 B
Go
27 lines
622 B
Go
package controller
|
|
|
|
import (
|
|
"homestead/homestead_gateway/util/config"
|
|
"homestead/homestead_gateway/util/logger"
|
|
"homestead/homestead_gateway/ws"
|
|
)
|
|
|
|
func NewGatewayController(cfg config.Config) GatewayController {
|
|
wsl, wCloseFn, err := logger.New("Websocket", cfg.Log)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
modHandler := ws.NewLoggingModHandler(wsl)
|
|
botHandler := ws.NewLoggingBotHandler(wsl)
|
|
|
|
return GatewayController{
|
|
Websocket: ws.NewWebsocketGateway(cfg.Gateway, wsl, wCloseFn, modHandler, botHandler),
|
|
HttpServer: HttpGateway{},
|
|
}
|
|
}
|
|
|
|
func (gc *GatewayController) Run() error {
|
|
return gc.Websocket.Start()
|
|
}
|