PlayerTTL unexpected disconnected, player stuck in room and can't join the same room

Two question:

I am making a mobile game, I use playerTTl to avoid IOS players leaving the room from running in the background. It works fine, except I can't handle unexpected disconnect, e.x. internet disconnected. When a Player clicks the Exit button to leave PUN room, it will call PhotonNetwork.LeaveRoom(false) so the player will leave the room without considering playerTTl, but when player disconnected due to internet problem, the player will be stuck in the room and occupy a room space(my game require 4 players to start but a player stuck in room means other playres can't start the game untile playerTtl time out). How do you handle the issue?

Another thing is when the player is stuck in a PUN room. It seems he/she can't join the same room( it will recreate a new one instead), I am thinking about calling rejoin room, but how do I know the player is stuck in a room before so I need to call reJoin rather than create a new one.

Many thanks

Best Answer

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021 Answer ✓

    Hi @scozirge,

    Thank you for choosing Photon!

    How do you handle the issue?

    Read here and here.

    but how do I know the player is stuck in a room before so I need to call reJoin rather than create a new one.

    maybe cache something locally on the device.

    or add something on your backend using webhooks.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2021 Answer ✓

    Hi @scozirge,

    Thank you for choosing Photon!

    How do you handle the issue?

    Read here and here.

    but how do I know the player is stuck in a room before so I need to call reJoin rather than create a new one.

    maybe cache something locally on the device.

    or add something on your backend using webhooks.

  • Thanks, got more things to do but should be fixable.