JoinRandomRoom fails but OnPhotonRandomJoinFailed will not be called back!!!

I use JoinRandomRoom and when OnPhotonRandomJoinFailed is called back, i know any room not exists then i use CreateRoom. because PUN has not any api like JoinRandomRoomOrCreate().
My problem is that in rarely times, JoinRandomRoom throws error GameDoesNotExist and OnPhotonRandomJoinFailed will not be called back.

Best Answer

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2017
    Hi @ahoogol,

    GameDoesNotExist is an error for JoinRoom operation and not for JoinRandomRoom. It happens on GameServer.
    It happens when the MasterServer returns a GameID and GameServer IP address to the client for a matched room as a response to JoinRandomRoom operation. But meanwhile when the client disconnects from MasterServer and then connects to GameServer and tries to enter the room using JoinRoom operation the room does not exist anymore as it was disposed by the server.

    What you can do:
    1. You can try to increase the EmptyRoomTTL, max value for cloud is 300000 milliseconds (5 minutes) to avoid this case.
    2. Use AsyncRandomLobby type. Rooms stay listed inside this lobby for 1 hour after they are disposed. I need to check if you need some webhooks config for this as well.
    3. When you catch this error, repeat JoinRandomRoom logic.
  • ahoogol
    ahoogol
    edited January 2017
    Hi @JohnTube
    JohnTube said:

    3. When you catch this error, repeat JoinRandomRoom logic.

    How? The error occures In NetworkingPeer.cs line 1534:
    else
    {
         Debug.LogError("Operation failed: " + operationResponse.ToStringFull() + " Server: " + this.Server);
    }
    How can i catch it?