I realize this is common question and I have read the previous posts about it but they don’t quite answer what I’m wondering about.
If the player goes offline you can detect it by a try/catch on a nakama call, but my question is what would be the best approach after that. Here’s what I do now:
- Try/catch to get any network error, whenever a nakama call is being made
- Push a “connection error”-popup on player (potentially forcing the load screen), the player can press “Try again” to reconnect.
- The reconnect will authenticate/restore the session and if the socket is reporting as disconnected it’ll connect the socket.
But that won’t really work as you can restore the session while being offline and the socket reports as connected even if you disconnect.
So a couple alternatives I’ve come up with would be to either do a new authentication call to catch it (so never restore after a network error), or do some Ping RPC call to catch it, and then once again show the popup.
Does anyone have a better practice for this?