24 lines
509 B
Go
24 lines
509 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)
|
|
}
|
|
|
|
return GatewayController{
|
|
Websocket: ws.NewWebsocketGateway(cfg.Gateway, wsl, wCloseFn),
|
|
HttpServer: HttpGateway{},
|
|
}
|
|
}
|
|
|
|
func (gc *GatewayController) Run() error {
|
|
return gc.Websocket.Start()
|
|
}
|