Blef-team / blef_game_engine

The game engine API service for the game of Blef
GNU Affero General Public License v3.0
1 stars 0 forks source link

Issue 182 implement a watch game streaming websocket api endpoint #183

Closed adrian-golian closed 2 years ago

adrian-golian commented 2 years ago

Closes #182

maciej-pomykala commented 2 years ago

At the moment, to use the public games WebSocket, a client needs to first request the list of public games from the stateless endpoint, and only then get updates from the WebSocket, and keep track of the list internally. I propose we either: 1) re-send the whole list of public games via the WebSocket in api/watch-game-stream.py; or, if that seems awkward, 2) keep a single JSON of public games (e.g. in DynamoDB), make api/watch-game-stream.py update that JSON, and stream that.

The second solution might be tricky if two processes try to update the single source of truth at the same time (the information about the first of the games that got updated might be brought back to its old state). Maybe, though, we can

3) stream directly from the global secondary index we have for public games?