I am getting closer to finishing a turn based game that uses Moralis cloud (my sudo-server), database, and live queries.
One of the finer points I am anticipating…
- If a player joins the game, it subscribes live queries.
- If that player uses the “leave game” button, the client will request itself be unsubscribed from the live queries and the server will remove the player.
This, however, doesn’t consider if a player loses connection or just closes the browser. Is there a way to trigger cloud code if this happens?
I took a look at this part of the docs: https://docs.moralis.io/moralis-server/database/live-queries#livequeryclient but I’m not totally sure if it’s related or not.
Perhaps I can request sessionToken? https://docs.moralis.io/moralis-server/database/live-queries#sessiontoken (are these shown in the database browser?)
Any point in the right direction would be appreciated!