onRoomCreated not being called, Room search with properties and players, Getting properties within the server code

0 votes

I am trying to create a room by the user when there are no rooms currently with the matched properties and with space for the player.

I am currently searching for rooms with

warpClient->joinRoomInUserRange(0, 7, 7);

then checking for a failed join in onConnectDone to create a new room with

std::map <string, string> properties;
properties["level"] = "1";
warpClient->createRoom(std::string("userCreatedRoom"), std::string("Admin"), 8, properties);

but after this, onRoomCreated is never called even though I can see in the server output that the room has been created as I have

    public void handleCreateRoomRequest(IUser user, IRoom room, HandlingResult result)
        System.out.println(user.getName() + " requested to create room " + room.getName() + " with ID " + room.getId());
        room.setAdaptor(new ChatRoomAdaptor(room));

How do I get my app to callback onRoomCreated?

Is it also possible to search for a room with certain properties, like with using joinRoomWithProperties, but also a certain range of current players?

Also, how do I get the properties of a room from within the server code? I want to find out what "level" property the room so I can apply the appropriate logic but I can only currently see that I can add and remove properties


Could someone also follow up this other question?


asked Mar 4, 2014 in AppWarpS2 by scott.woolven (35 points)
retagged Mar 11, 2014 by shepAdmin

1 Answer

0 votes
Best answer
Hi -

You need to set the zone request listener. The client SDK will then callback the onCreateRoomDone function of the listener.

For a customized search of rooms you'll need to define a zone RPC and implement that on the server.

We are releasing a new update on Friday (March 7) which will contain the ability to access and update properties from the server itself.

Also I've updated your other question.

Hope it helps!
answered Mar 5, 2014 by dhruvc (1,099 points)
selected Mar 5, 2014 by scott.woolven
I am setting the zone request listener along with the connection request, room request and notification listeners:

AppWarp::Client::initialize(api_key, ip);
    warpClient = AppWarp::Client::getInstance();

Okay, thanks.

Okay, I will be sure to download that then.
are you getting onCreateRoomDone response listener fine now?
Please note that onRoomCreated is a notification callback and not a response callback. You get that if you've subscribed to the lobby and someone creates a new dynamic room.
Ahh, okay. I was just using the wrong response listener. Everything is working now.
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