Room Max TimeToLive


We are working on a turnbased game for a maximum 6 users per room, and the users can be invited in Facebook to join some specific room by name.

We need the room's max ttl to last at least two hours, so the invited user can check it's invitation and join the room in this time frame.

But, the room max ttl we can get is 2 minutes.

Is there a way to set the room to have the max ttl for 2 hours or more?



  • Philip
    Hi hgbimonti,

    for invitations as you already said your players will be joining per RoomName.
    There is a trick you can use in that case:

    1st time the player joins the room use the OpJoinOrCreate.
    2nd and later the players can use Join with actorNr = -1 (which triggers a ReJoin).

    The Room TTL is not important for this case - since if the room is not loaded Photon Cloud will call the webhook to get the state.

  • Hi, Phillip

    Thanks for the reply.

    We have the rejoin working already.

    The problem is the first time the player gets in the room, for example: I have a friend that created a room and invited me in Facebook. At the moment he invited me I was not online, and he left the room. I got my invitation on Facebook 30 minutes later (I have never entered the room) and when I try to join, the room does not exists on lobby anymore because my friend have left.

    What we need is that the room stays open in the lobby for about 2 hours so all friends invited can join for the first time in this timeframe.

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi hgbimonti,

    What Philip was trying to say that since your friend sent you the challenge invitation on facebook, you should find a way to send him the Room Name (GameId) in that invitation. So EVEN if you leave the Room and the EmptyRoolTTL expires so the Room gets removed from Photon Servers' memory you can rejoin it but this needs one more condition. You need Webhooks properly configured and in the GameClose webhook's code (Type=="Save") you should save the Room's State (which is sent as an argument of the Webhook) somewhere. When you or your friend will try to rejoin that "removed" Room, GameCreate will be fired with Type="Load" where you need to retrieve that previously saved "State" knowing its GameId always from webhook arguments.

    So this could be independent from Lobby type or EmptyRoomTTL since you have the Room Name (GameId) ! I would recommend creating the Room with RoomOptions.Visible = false to avoid that someone else tries to enter it from the lobby !

    In case you STILL want Rooms to persist in a Lobby even when empty for a longer time consider using AsyncRandomLobby which will give you an extra HOUR after EmptyRoomTTL timeout.
  • Thanks for the reply, John!

    I'll try the "actorNr = -1" thing and see if the webhooks responds properly.

  • JohnTube
    JohnTube ✭✭✭✭✭
    @hbimonti :

    Are you sure you managed to get EmptyRoomTTL up to 2 minutes (EmptyRoomTTL=120000 milliseconds) ?

    If I try to go above 1 minute I get this error :
    OperationResponse 227: ReturnCode: -1 (Can not create game with EmptyRoomLiveTime == 60001. maxTTL must be increased)

    Anyway, according to the docs here :
    A best-practice value is 12 seconds.

    12 seconds => 12000 milliseconds