How to implement getAllRooms() and getLiveRoomInfo()

0 votes
I can't seem to return a roomTable value, all 3 appWarp samples with corona sdk doesn't have this function so it's quite unclear how to return these values, no sample codes either only APIs. if someone can only give me a portion of code on how to return it, that would be helpful. TNX
asked Dec 14, 2015 in AppWarp by rhaineyensid (10 points)

1 Answer

0 votes

Hello Developer,

Please have a look at this link to get all rooms and information of live room:

While calling the above api, you need to define the callback(onGetAllRoomsDone , onGetLiveRoomInfoDone ) from which you get the rooms information like room name, owner of that room, custom table etc. 

Please have a look into it and let us know if you need any help while integrating it. 

Regards,

HImanshu Sharma

 

answered Dec 15, 2015 by hs00105 (2,005 points)
HImanshu, yes i already checked this before and this is where my problem started. I can't seem to integrate it. I'm curious how to use onGetAllRoomsDone (resultCode , roomsTable )  because compare to other given samples, this returns roomsTable which im not quite sure if it needs looping or what. also i can't return the room values, im not sure if the correct syntax can be print(roomTable.id, roomTable.maxUsers) that's what I am doing just to check it first.
Hello,

In that case, what we can do is we can create one sample project which have this functionality available with you. So could you please tell me exactly what you need to extract and return. it will help us to provide better support to you.

Regards,
Himanshu Sharma
HImanshu, thanks! can we create a sample project that will include these functions..

1.function that will get all rooms and properties whether all users are offline, both static and dynamic rooms.

2. function that will get all users info whether users are offline or online

3. function that will store some info in the back end like system time, or unsent pm's that can be retrieved.

Just a simple project that will simply print them once i run the main.lua even there are no widgets, as long as i can retrieve and send all info. Thanks alot!
Hello rhaineyensid,

Apologies for getting late back to you.

We have created one sample(https://www.dropbox.com/s/9uccwcar5vocsjd/Chat.zip?dl=0) for you which implements getAllRooms and getLiveRoomInfo along with its corresponding callbacks.

Let us know if you face any problem, we will be happy to help you.

Thanks.
Himanshu
Finally! Thanks for replying. Though i think the sample contains old version of corona syntax like storyboard which has been replaced by composer already and other scene functions. I managed to do some work around with that. But we still have a problem. I tried elimination method to compare two different functions:

display.setStatusBar( display.HiddenStatusBar )

appWarpClient = require "AppWarp.WarpClient" --import appwarp plugin

API_KEY = "###########################"  --some random characters here from my api key
SECRET_KEY = "##########################"  --some random characters here from my secret key
STATIC_ROOM_ID = "##########"  --some random characters here from my room id


appWarpClient.initialize(API_KEY, SECRET_KEY) --start appwarp

appWarpClient.connectWithUserName(tostring(os.clock()))  --add username

function onConnectDone(resultCode)
  print(resultCode)                       --try printing to see if function really works
end

appWarpClient.addRequestListener("onConnectDone", onConnectDone)

local function gameLoop(event)
  appWarpClient.Loop()
end

Runtime:addEventListener("enterFrame", gameLoop)

//** I do understand that the above function won't connect online. But this is only to prove if the function is being read every time I run the main.lua. And it prints the result code which means this function is alive. Now I removed this function and used onGetLiveRoomInfo() **//


display.setStatusBar( display.HiddenStatusBar )

appWarpClient = require "AppWarp.WarpClient" --import appwarp plugin

API_KEY = "###########################"  --some random characters here from my api key
SECRET_KEY = "##########################"  --some random characters here from my secret key
STATIC_ROOM_ID = "##########"  --some random characters here from my room id


appWarpClient.initialize(API_KEY, SECRET_KEY) --start appwarp

appWarpClient.connectWithUserName(tostring(os.clock()))  --add username

function onGetLiveRoomInfoDone(resultCode,roomTable)
  print(resultCode)     --didn't print anything even 5==error
end

appWarpClient.addRequestListener("onGetLiveRoomInfoDone", onGetLiveRoomInfoDone)

local function gameLoop(event)
  appWarpClient.Loop()
end

Runtime:addEventListener("enterFrame", gameLoop)


//** Didn't print any even 5 (error), and not only this but other related getRoom functions are dead. I thought I was doing it wrong before by printing roomTable.name but when I saw your sample, my previous syntax was correct and it is just the function not being read **//
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
...