Fail to reconnect and rejoin when i loss internet for more than 5 seconds

I am developing a game of questions player vs player and when my mobile loses connection, when I reconnect and rejoin if the Internet fall is of very little time, 1 second or so, reconnects without problem, but if the fall is more than 5 seconds or so gives me a fault and says it can not reconnect because it is already connecting despite checking the status with this method:
if (!PhotonNetwork.connected && !PhotonNetwork.connecting)
{
	if (previousRoom != null) {
		previousRoom = null;
		PhotonNetwork.ReconnectAndRejoin();
	}
	else
	{
		PhotonNetwork.ConnectUsingSettings(_gameVersion);
	}
}
I also use PlayFab and I do not know if it has something to do with the failure. In both cases the player is disconnected from the server.

Comments

  • edited January 9
    Hi @viridesoft,

    when setting up the room you can set values for timeouts which allows players to reconnect to the game. You can set this by using the following code snippet and apply these RoomOptions when creating the room.
    RoomOptions options = new RoomOptions();
    options.PlayerTtl = 60000; // players will be removed from the room 60 seconds after they have a disconnect
    options.EmptyRoomTtl = 30000; // room will be removed 30 seconds after the last client has left it
  • My code when i create a room:
    RoomOptions roomOptions = new RoomOptions(); roomOptions.PlayerTtl = 60000; // 60 sec roomOptions.EmptyRoomTtl = 15000; // 15 sec roomOptions.MaxPlayers = MaxPlayersPerRoom; PhotonNetwork.CreateRoom(null, roomOptions, null);
Sign In or Register to comment.