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

@@ -4,6 +4,7 @@ import (
"bufio"
"encoding/json"
"fmt"
"github.com/googollee/go-socket.io"
"github.com/julienschmidt/httprouter"
"github.com/pterodactyl/wings/server"
"go.uber.org/zap"
@@ -30,6 +31,8 @@ func (sc *ServerCollection) Get(uuid string) *server.Server {
type Router struct {
Servers ServerCollection
Socketio *socketio.Server
// The authentication token defined in the config.yml file that allows
// a request to perform any action aganist the daemon.
token string
@@ -263,5 +266,7 @@ func (rt *Router) ConfigureRouter() *httprouter.Router {
router.POST("/api/servers/:server/power", rt.AuthenticateToken("s:power", rt.AuthenticateServer(rt.routeServerPower)))
router.GET("/api/ws/:server", rt.AuthenticateServer(rt.routeWebsocket))
return router
}