How to Handle Disconnections

In your Sync Controller class, you can implement the following functions to handle disconnection problems. You can use these functions to control the state of the game on both devices such as pausing and un-pausing the game when a user loses or re-establishes connection.

onMatchCompleted

This method gets called when one of the users has submitted a score or aborted their match.

onCurrentPlayerHasLostConnection

This function is called whenever the current player loses connection. You can use this to notify the current player that they have lost connection.

onCurrentPlayerHasReconnected

This function is called when the current user has reconnected.

onCurrentPlayerHasLeftMatch

This function is called when the current user has left the match.

onOpponentHasLostConnection

The function is called whenever the opponent loses connection. You can use this to notify the current player that their opponent has lost connection.

onOpponentHasReconnected

This function is called when the opponent has reconnected.

onOpponentHasLeftMatch

This function is called by when the opponent has left the match.

For more information on these methods, view our Advanced documentation.