I want to process packets sent from the socket when the tab is hidden, how can I synchronize the client with the server?
Pls describe more details of your problem?
Is there any way to hide the game on Android, iOS and the web so that the application still runs in realtime with the server? I’m having a problem hiding the game or the web when showing the effects in progress on the client out of sync with the server…
What I’m doing is that when hidden, it will clear everything and reopen it to send the packet again, but I don’t find that method feasible
@Tom_k Please help me!
There is not such a way.
It’s OK to stop processing messages sent from the server side when your game is brought into the background.
When you resume your application or web page from the background to the front.
It will continue handling the data that is received.
The only thing you need to do is to check if you have hidden your game too long.
If so, you’d better pull the whole data from the server and reload the scene to reconstruct your game world.
That is what I’m doing in my online game project.
I hope my words above could help you a little.
I make an online hand card game when I stop so the opposing player and the player will be out of sync