Some more changes for the new game handling api and also rate limiting #13

Merged
marco merged 4 commits from game-handler into master 2024-05-12 13:48:23 +00:00
3 changed files with 13 additions and 0 deletions
Showing only changes of commit 58002a1b38 - Show all commits

View File

@ -126,3 +126,9 @@ func JoinPrivateGame(c *gin.Context) {
c.Header("Access-Control-Allow-Origin", "*")
c.IndentedJSON(http.StatusOK, info)
}
func JoinGame(c *gin.Context) {
gameID := c.Param("id")
log.Println(gameID)
c.JSON(http.StatusOK, gameID)
}

View File

@ -70,3 +70,7 @@ func waitForAndHandlePlayerID(ctx context.Context, conn *gorillaws.Conn) {
lobby.Game.SetWebsocketConnectionFor(ctx, player, conn)
log.Println("player after setting connection: ", player)
}
func ConnectWsForGame(c *gin.Context) {
}

View File

@ -28,7 +28,10 @@ func main() {
router.GET("/api/hostPrivate", handler.HostPrivateGameHandler)
router.POST("/api/joinPrivate", handler.JoinPrivateGame)
router.GET("/api/ws", websocket.RegisterWebSocketConnection)
router.GET("/api/getLobbyForPassphrase/:phrase", handler.GetLobbyForPassphraseHandler)
router.GET("/api/registerWsForGame/:id", websocket.ConnectWsForGame)
router.POST("/api/joinGame/:id", handler.JoinGame)
if debugMode {
log.Println("Starting service WITHOUT TLS")