Skip to content

Commit

Permalink
fix: change the websocket connection URLs to be correct
Browse files Browse the repository at this point in the history
  • Loading branch information
jahrim committed Aug 29, 2023
1 parent 8d98ef1 commit fed97a5
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ class ChessGameHttpAdapter(
router
.post("/game")
.handler(message =>
val gameConfiguration =
message.requireBodyParam("gameConfiguration").as[GameConfiguration]
val gameConfiguration = message.requireBodyParam("gameConfiguration").as[GameConfiguration]
context.api
.createGame(gameConfiguration)
.map(gameId => bson { "connection" :# { "websocket" :: s"/game/connect/$gameId" } })
.map(gameId =>
bson { "connection" :# { "websocket" :: s"/game/connect/$gameId/websocket" } }
)
.onSuccess(bson => message.sendBson(HttpResponseStatus.OK, bson))
.onFailure(message.sendException)
)
Expand All @@ -78,7 +79,9 @@ class ChessGameHttpAdapter(
.handler(message =>
context.api
.findPublicGame()
.map(gameId => bson { "connection" :# { "websocket" :: s"/game/connect/$gameId" } })
.map(gameId =>
bson { "connection" :# { "websocket" :: s"/game/connect/$gameId/websocket" } }
)
.onSuccess(bson => message.sendBson(HttpResponseStatus.OK, bson))
.onFailure(message.sendException)
)
Expand All @@ -89,7 +92,9 @@ class ChessGameHttpAdapter(
val gameId = message.requirePathParam("gameId")
context.api
.findPrivateGame(gameId)
.map(gameId => bson { "connection" :# { "websocket" :: s"/game/connect/$gameId" } })
.map(gameId =>
bson { "connection" :# { "websocket" :: s"/game/connect/$gameId/websocket" } }
)
.onSuccess(bson => message.sendBson(HttpResponseStatus.OK, bson))
.onFailure(message.sendException)
)
Expand Down

0 comments on commit fed97a5

Please sign in to comment.