Some more changes for the new game handling api and also rate limiting #13
@ -126,3 +126,9 @@ func JoinPrivateGame(c *gin.Context) {
|
|||||||
c.Header("Access-Control-Allow-Origin", "*")
|
c.Header("Access-Control-Allow-Origin", "*")
|
||||||
c.IndentedJSON(http.StatusOK, info)
|
c.IndentedJSON(http.StatusOK, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func JoinGame(c *gin.Context) {
|
||||||
|
gameID := c.Param("id")
|
||||||
|
log.Println(gameID)
|
||||||
|
c.JSON(http.StatusOK, gameID)
|
||||||
|
}
|
||||||
|
@ -70,3 +70,7 @@ func waitForAndHandlePlayerID(ctx context.Context, conn *gorillaws.Conn) {
|
|||||||
lobby.Game.SetWebsocketConnectionFor(ctx, player, conn)
|
lobby.Game.SetWebsocketConnectionFor(ctx, player, conn)
|
||||||
log.Println("player after setting connection: ", player)
|
log.Println("player after setting connection: ", player)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ConnectWsForGame(c *gin.Context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
3
main.go
3
main.go
@ -28,7 +28,10 @@ func main() {
|
|||||||
router.GET("/api/hostPrivate", handler.HostPrivateGameHandler)
|
router.GET("/api/hostPrivate", handler.HostPrivateGameHandler)
|
||||||
router.POST("/api/joinPrivate", handler.JoinPrivateGame)
|
router.POST("/api/joinPrivate", handler.JoinPrivateGame)
|
||||||
router.GET("/api/ws", websocket.RegisterWebSocketConnection)
|
router.GET("/api/ws", websocket.RegisterWebSocketConnection)
|
||||||
|
|
||||||
router.GET("/api/getLobbyForPassphrase/:phrase", handler.GetLobbyForPassphraseHandler)
|
router.GET("/api/getLobbyForPassphrase/:phrase", handler.GetLobbyForPassphraseHandler)
|
||||||
|
router.GET("/api/registerWsForGame/:id", websocket.ConnectWsForGame)
|
||||||
|
router.POST("/api/joinGame/:id", handler.JoinGame)
|
||||||
|
|
||||||
if debugMode {
|
if debugMode {
|
||||||
log.Println("Starting service WITHOUT TLS")
|
log.Println("Starting service WITHOUT TLS")
|
||||||
|
Loading…
Reference in New Issue
Block a user