LoadBalancingClient.getRoomList() sometimes returns empty list

I am struggling with the strange issue.

Sometime when I call LoadBalancingClient.getRoomList() , it returns empty vector when there is actually a number of rooms present. After making the same call in 3-5 seconds it returns the complete list.

The same with LoadBalancingClient.opJoinRoom(). Sometimes when I first get a room from a list then try to join it, it fails. The next join to the same room could succeed.

No connectionErrorReturn, clientErrorReturn, warningReturn, serverErrorReturn called.

How could I debug it? What to look for?


  • Hi @ufnv.

    The list of rooms is not updated immediately every time a new room gets created, but in intervals. The default interval, that is in use on Photon Cloud is once every second. I think that this interval can be adjusted on self-hosted servers / Enterprise Cloud.

    However once a room appears in that list it should be joinable (if it is not closed or full).
    Are you attempting to join that room by name or are you attempting to join a random room that matches certain filters? If the latter is the case, please check if the former is working.
    My guess is that this is related to your other thread and that the custom properties of that room have just not been updated yet and hence there is no room that matches your filters at that moment of time.
  • ufnv
    edited October 2020
    No, it is a little different.

    The problematic part of code looks like this (schematically):

    <select a room from the list and get it's stored "UID" property>

    <searching for the room with the "UID" we've got before> - FAIL

    Even some simpler example:
    LoadBalancingClient.getRoomList(); - vector size>0

    after 5 seconds

    LoadBalancingClient.getRoomList(); - vector size == 0

    another 5 seconds:

    LoadBalancingClient.getRoomList(); - vector size>0 again
  • Hi @ufnv.

    When you connect to Photon and join the lobby, then it takes a moment, until the room list gets updated for the first time. During that moment it is empty.

    You are informed about room list updates by calls to your implementation of Listener::onRoomListUpdate().

    Once you have received the first call to that function after you have joined the lobby (Note that when 'autoJoinLobby' is true (which is the default), then a client will automatically join the default lobby during connect and you are inside that lobby once you receive a call to connectReturn(). If you explicitly join a lobby via opJoinLobby(), then a call to joinLobbyReturn() indicates that the lobby has been joined), the room list should be populated.

  • Thanks, this definitely can be the case. I am joining with autoJoinLobby and call getRoomList() right after the connectReturn(). Probably the room list is not always populated at this moment, will try to wait for onRoomListUpdate()
  • Yes, looks like it's the case.

    I get the callback to connectReturn() before onRoomListUpdate(), so there is a high chance to get an empty room list.