Page 1 of 1

Login request response is different from the C++ API

Posted: 15 Nov 2013, 09:17
by Antoniocide
Hi,

I was trying to make a login to a server already working. When I get the response of the server to the LoginRequest I have 2 params "data" and "reason" instead of "data" and "user" that says the C++ API:
http://docs2x.smartfoxserver.com/api-do ... 9ab851b559

Also, there is a problem when I try to access to the "data" content, because I get the game crashed with the following error:
Assertion failed: (px != 0), function operator->, file /Users/ramon/Desktop/boostoniphone-master/framework/boost.framework/Headers/smart_ptr/shared_ptr.hpp, line 424.

The code I use to retrieve the information of the LoginRequest response is this:
boost::shared_ptr<map<string, boost::shared_ptr<void> > > ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueData = (*ptrEventParams)["data"];
boost::shared_ptr<SFSObject> ptrValue = (boost::static_pointer_cast<SFSObject>)(ptrEventParamValueData);

Thank you very much.

Re: Login request response is different from the C++ API

Posted: 18 Nov 2013, 10:40
by MBagnati
Hi,
To investigate the issue, I have done a login using the SimpleChat sample.

SimpleChat subscribes the login event by CMainFrame::InitializeSmartFox method contained into MainFrm.cpp
(see attached image Image01.png)

When the login event is fired, the registered listener OnSmartFoxLogin is called.
I have set a breakpoint in this method and using the debugger I have verified that the notified event contains information about "data", "user" and "zone"
(see attached image Image02.png)

So, by adding few rows into OnSmartFoxLogin I can retrieve information about logged-in user and associated zone, whereas data section is meaningless for this operation
(see attached image Image03.png)

Please, can you check the same pattern in your context?

Re: Login request response is different from the C++ API

Posted: 26 Nov 2013, 10:18
by Antoniocide
Thank you for your response, I managed to get time to check it and it worked well the SimpleChat sample. After that, I asked to the person who set up the server and he told me that there was a restriction to Log in with the password, so the response was wrong because the restriction of the password was not acomplished.

I am sorry for the trouble.