Ugly first attempt at enabling socketio

This commit is contained in:
Dane Everitt
2019-04-07 16:28:01 -07:00
parent 7c0acf3f60
commit afe2941983
5 changed files with 207 additions and 8 deletions

View File

@@ -73,6 +73,16 @@ func main() {
token: c.AuthenticationToken,
}
if sock, err := r.ConfigureWebsocket(); err != nil {
zap.S().Fatalw("failed to configure websocket", zap.Error(err))
return
} else {
r.Socketio = sock
}
defer r.Socketio.Close()
go r.Socketio.Serve()
router := r.ConfigureRouter()
zap.S().Infow("configuring webserver", zap.String("host", c.Api.Host), zap.Int("port", c.Api.Port))
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", c.Api.Host, c.Api.Port), router); err != nil {