Hi, in server side i'm sending request handler like this
// Obtain a resultset
ISFSArray res = dbManager.executeQuery(sql);
// Populate the response parameters
ISFSObject response = new SFSObject();
response.putSFSArray("userData", res);
// Send back to requester
send("checkPlayerExist", response, sender);
the question is, in onExtensionResponse:(SFSEvent *)evt method on client side, how do i check if the "userData" is exist or the kind of extension request is "checkPlayerExist"?
thank you
How to check extension request object from server?
Re: How to check extension request object from server?
Please check the API documentation: http://docs2x.smartfoxserver.com/api-do ... onResponse:
As you can see the cmd parameter on the event object contains the name of the response sent by the server, in your case "checkPlayerExist".
In the params parameter you will then find that "userData" object.
As you can see the cmd parameter on the event object contains the name of the response sent by the server, in your case "checkPlayerExist".
In the params parameter you will then find that "userData" object.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: How to check extension request object from server?
ah, i figured it out
in onExtensionResponse method i write like this
thanks Bax
in onExtensionResponse method i write like this
Code: Select all
-(void)onExtensionResponse:(SFSEvent *)evt
{
SFSObject *data = (SFSObject*)evt.params[@"params"];
//check with "containsKey" function if "userData" array exist
if ([data containsKey:@"userData"])
{
//do something
}
}
thanks Bax
Return to “SFS2X iPhone / iPad / OSX API”
Who is online
Users browsing this forum: No registered users and 39 guests