Rejoin
Rejoin allows you to display a dialog to rejoin a group from which you have been disconnected from during a multiplayer session.
Rejoin allows you to display a dialog to rejoin a multiplayer session that has been interrupted by a disconnection. This feature only displays a dialog. You are responsible for handling the actual rejoining and deep linking.
If all users have left the session and a user tries to rejoin, you can configure the application to display an error message that the session is no longer valid to be joined because all participants have left.
Check
Error Dialogs for more information about including dialogs in your application.
Launch the Rejoin dialog, which allows the user to rejoin a previous lobby or match. You must populate the lobby_session_id
or the match_session_id
, or both.
public static Request<Models.RejoinDialogResult> LaunchRejoinDialog(string lobby_session_id, string match_session_id, string destination_api_name)
If no error occurs, a message returns when the user selects an option and the dialog closes.
A user is in a roster with a few other people.
- Their app crashes, and they need to relaunch. When the app relaunches, they see the Rejoin dialog and rejoin the group from there.
- They lose their internet connection for a short period of time, and they disconnect from the group and back to the main menu of the app. When the internet connection restores, they see the Rejoin dialog and rejoin the group from there.
You can use the Rejoin dialog after any accidental (or perhaps intentional) disconnect from the roster/group. Use Rejoin to give the user a choice as to whether they want to be put back into the group they used to be in.
The following example code invokes the Rejoin functionality:
GroupPresence.LaunchRejoinDialog("123", "456", "my_destination_name").OnComplete(message =>
{
if (message.IsError)
{
// Get the error message here.
}
else
{
// The user has acted upon the dialog successfully. Check the user’s decision here.
}
});
- Make sure the Rejoin dialog is open for a valid, active roster.
- If applicable, pass in a valid destination_api_name.