How can i get the room list in iOS native app?
Comments
-
Hi @phsojitra.
Room lists are only available to clients that are inside a lobby of type 'Default'. If you have not set the EGLoadBalancingClient.AutoJoinLobby property to false, but left it on its initial value of true, then the client automatically joins the default lobby, which is of type 'Default' when it connects to Photon. It also will then automatically return to that lobby whenever it leaves a game room. Note that a client leaves the lobby when it enters a game room, as each client can always only be active in one room at a time and lobbies are just special rooms.
The most up to date room list that is available can be accessed through EGLoadBalancingClient.RoomList.
The optional EGLoadBalancingListener::onRoomListUpdate() callback gets called by Photon to inform your code whenever a new room list update has arrived from the server, so that you can then retrieve the latest room list from EGLoadBalancingClient.RoomList, so implement it if you want to keep informed about room list updates.
The client receives an initial room list shortly after joining the lobby and then updates in short intervals afterwards, while it is in the lobby. It does not get updates while it is in a game room, but new updates will arrive again when it returns to the lobby.
1 -
Yay i got the solution!!!
if networkLogic.client.isInLobby
{
let iDictRoomList : NSDictionary = networkLogic.client.roomList! as NSDictionary
for (iCounter , _) in iDictRoomList.allKeys.enumerated()
{
let iStrRoomNme : String = (iDictRoomList.allKeys)[iCounter] as! String
let room = (iDictRoomList.object(forKey: iStrRoomNme)) as! EGLoadBalancingRoom
print(room)
print(room.customProperties)
}
}0 -
Thanks @Kaiserludi admin
i followed your steps and implement the same way thanks again for your greta support
0