Ugly first attempt at enabling socketio
This commit is contained in:
5
http.go
5
http.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user