Duplicate OnRoomListUpdate Callback.

Hey, thanks in advance for any help.

The current issue I'm facing is when I leave a room, OnRoomListUpdate() gets called twice. The first call lists rooms correctly, the second one adds a room back with 0 players.

Through logs and debug I see that when I leave a room, I reconnect to master. Then the OnRoomListUpdate callback occurs. Then 1 second after calls again with an empty room.

To leave the room I am calling LeaveRoom(false), as to abandon. And played with room options like CleanupCacheOnLeave, EmptyRoomTtl, and PlayerTtl.

No luck. For now, I will just have a check on the room button prefab to self destruct if the player's count is 0. My intention is to never have an empty room in the list.

Cheers :smile:

Best Answer

Answers

  • Hey. I did.
    I think it may have been my workflow. After making a second version I broke up lobby/room between two scenes. And when I rejoined the lobby I triggered a disconnect/reconnect give a fresh connection.
  • fastbyte22
    edited April 2020
    Hi, I have just noticed that this is exatcly the error I am facing right now: when I leave a room with options: EmptyRoomTtl = 0 and PlayerTtl = 0, OnRoomListUpdate gets called twice: firstly with 0 rooms but right after with the room I have just left only with players 0/0.
  • S_Oliver
    S_Oliver ✭✭✭
    edited April 2020
    Did you check out if the RoomInfo -> RemovedFromList is true ?

    So the 2nd call just tells you that the room is deleted .
  • Hello, i have the same issue, i have lobby and room panel in same scene, when i leave room, i get OnRoomListUpdate twice: first with normal rooms, second with rooms 0/0 players.
    If the second call just says that room was deleted, why in this call aren't other rooms.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Kiberkachok,

    Thank you for choosing Photon!
    When the client joins a lobby of default type, it instantly gets an initial list of available rooms. After that the client will receive periodic room list updates.
    doc page source
  • Oh, thanks you very much!
  • hello! I have exactly this same problem, but it only occurs when, for example, 2 players create 2 different rooms in parallel, then when one of the players decides to leave his room to enter the other player's room, OnRoomListUpdate is called 2 times, the the first time correctly and the second time with the empty list

    The patch I found is to run disconnect and reconnect as follows:

         PhotonNetwork.LeaveRoom ();

         PhotonNetwork.Disconnect ();

         PhotonNetwork.ConnectUsingSettings ();

    But it got slower

  • Tobias
    Tobias admin
    edited December 2021

    OnRoomListUpdate provides updates to the room list. You need to maintain a list of known rooms and update them with each call of OnRoomListUpdate. If there is a callback with no entries, nothing changed and you can keep using the list you already had (with no modifications).

    The PUN package has the Asteroids Demo inside. It implements a room list and should show how to handle updates.

    To write this explicitly: OnRoomListUpdate does not give you the full room list to show! Initially, it's a long list but you receive updates to that list in intervals. So you have to update your list...

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2021

    Hi @cbritez,

    Thank you for choosing Photon!

    I wanted to add that:

    The PUN package has the Asteroids Demo inside. It implements a room list and should show how to handle updates.

    We have this in the documentation here.

    the the first time correctly and the second time with the empty list

    not sure how this could happen (how can we reproduce) and what the correct list should show?