I would like to store user's variables in our dabase. We are currently using an external user ID from facebook and when the user login we verify them against their stored uid and sig. everything works fines and i've been able to use the
addEventHandler(SFSEventType.USER_LOGIN, LoginEventHandler.class);
the client will provide LOGIN_NAME as facebook uid and LOGIN_PASSWORD as signature.
after the user succesfully login i will do
outData.putUtfString(SFSConstants.NEW_LOGIN_NAME, dbobject.getUtfString("name"));
to change their name to whatever we stored in our db.
the problem starts when the event
addEventHandler(SFSEventType.USER_JOIN_ZONE, UserJoinZoneEventHandler.class);
which is bascily where i would like to load all the user's variables. The problem is that when this event is fired i no longer have the facebook id to use.
any ideas how to add custom data so server can identify the user's id?
Storing and retrieving users
from the docs:
I hope this helps.
details about Session object here: http://docs2x.smartfoxserver.com/api-do ... ssion.htmlWhen working with asynchronous events such as USER_LOGIN and USER_JOIN_ZONE it's a bit more difficult to maintain the state of the current transaction/operation.
A convenient way to maintain the state is to use the User Session object. In particular the Session object allows to store custom parameters as key-value pairs. (See the javadoc, methods getProperty/setProperty etc...)
I hope this helps.
http://docs2x.smartfoxserver.com/Gettin ... wtos#item3
Check out the above.
You can assign various properties to the session object. The sessuib can later be called up via the user.getSession() or through event parameters.
Enjoy!
Check out the above.
You can assign various properties to the session object. The sessuib can later be called up via the user.getSession() or through event parameters.
Enjoy!