I developed a playing cards web app using HTML/JS/CSS. Communication with the server is performed using WebSocket. The server is developed in Java Spring.
The game proposes to join one of the many available tables where you can immediately perform an action.
The players who are already in the table are perfectly in sync with each other, as when they receive a message from the server, I show a screen overlay preventing them from clicking on any element on the table while an animation is running. After the animation is terminated, the game becomes available and runs normally.
My problem is that if a new player joins the table after a message has been sent by the server, then he can perform an action while the animation is still running for the other players, thus starting a new animation for them at the same time and the game becomes messy.
Is there a way to either prevent the new joiner from performing an action before the animation has ended for the rest of the players ? Do you have any other idea how I can solve this issue ?
Thanks for your help