I’m building a JS game with react, and I want to keep the game state on the server to prevent cheating.
My backend is an express server that handles game logic. When the user performs an action its result is saved to moralis DB from the frontend part, and then frontend sends a message to the backend via socket.io to download the updated state from DB and perform the action. After that the backend updates the DB and sends a message to the frontend to download the latest state of the game with the action results.
I noticed that this takes quite a bit of time, like 3-4 seconds, whereas if I just keep the state in the local storage it’s happening near instant. So my question is what is your suggestion on the best way to integrate a simple HTML game with moralis DB for the fastest speed and protection from cheating?