How i can get room name when i call GetAllRooms()

0 votes

Hi,

I am getting room ids when i call GetAllRooms() but i need room names also to display on my board. So how can i get room names ?

 

like in onCreateRoomDone(RoomEvent eventObj)  i can get room name by calling eventObj.getData().getName();

 

i want something like that in onGetAllRoomsDone (AllRoomsEvent eventObj) also, but i am unable to find the function which returns room name. could you please help me with this ?

asked Aug 1, 2015 in AppWarp by sushanta1991 (11 points)

1 Answer

+1 vote

Hi Sushanta,

Once you will get all the rooms with thier roomId's,then you can use getLiveRoomInfo(roomId) to get live information of room.

You will get a callback in onGetLiveRoomInfoDone, now you will able to find out room data with LiveRoomInfoEvent event:

  • RoomName using event.getData().getName()
  • Joined users using event.getJoinedUsers()

Let me know if it helps.

Thanks & Regards

Vishnu Garg

answered Aug 1, 2015 by Vishnu Garg (674 points)
thanks for the answer Vishnu, that's what i wanted, i didn't tried your solution yet but i know it will work.

I will let you know once i am done with testing.

and thanks to shephertz.com for creating this awesome platform, i am really enjoying your api's, they are very clean and simple.
getLiveRoomInfo(roomId)   works perfectly.

thanks for your answer.


I have another question, i have created 2 dynamic rooms from code and after closing my game i am still getting those rooms when i call GetAllRooms();
how long a room stays alive on server if there is no player active in that room ?
Default time for room existence is currently one hour, after one hour room will automatically deleted from server.
for your 2nd question, I use this line of code to delete room once the room is empty

@Override
    public void handleUserLeavingTurnRoom(IUser user, HandlingResult result)  
    {
        if(gameRoom.getJoinedUsers().isEmpty())
        {
            izone.deleteRoom(gameRoom.getId());
        }
    }
Yes, you can use delete Room API on AppWarpS2 server.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...