Page 1 of 1

Getting at the User object after logging in but not joining

Posted: 26 May 2010, 11:10
by drh_qtm
I'm using the AS3 client API and I'm having trouble working out if/how I can get access to the UserVariables after a user has logged in but before the user joins a room. I perform a custom login and get the username back in the extension response.

I can see in the client api docs I can set uservariables by doing sfsClient.setUserVariables but how can I get the user variables, there doesn't seem to be a coresponding method to get at user variables. I can see that via the Room I could do something like this to get at the User object:

sfsClient.getActiveRoom().getUser(sfsClient.myUsername())

But this only works if the user has joined a room, is there anyway to gget a handle on this if the user has yet to join a room?

Many thanks

Posted: 29 May 2010, 13:43
by Lapo
I'm using the AS3 client API and I'm having trouble working out if/how I can get access to the UserVariables after a user has logged in but before the user joins a room. I perform a custom login and get the username back in the extension response.

It can be done after you have joined a Room, not before. In other words the User cannot exist outside Rooms, so make sure to join on first.

If you need a temporary "limbo" area where to perform these tasks before joining a Lobby or Chat Room you can setup a default Room with the limbo attribute turned on. Limbo rooms are lightweight rooms that fire almost no events and allow to group hundreds or thousand of users that don't need to interact with each others.

Full details are found here:
http://www.smartfoxserver.com/docs/docP ... ecture.htm

Limbo rooms do not provide user variables though

Posted: 01 Jun 2010, 08:59
by drh_qtm
Hi Lapo,

Thanks for the reply however I have tried what you suggest and it seems that if I connect to a limbo room, access to the uservariables is not possible. I read through the documentation and found this which confirms that access to user variables isn't possible in Limbo rooms

When the limbo flag is turned on, the room suppresses certain events (new user arrived, user left, user count changed, room and user variables)

Posted: 01 Jun 2010, 10:10
by Lapo
Yes it's not possible for the reasons explained in the docs.
Limbo Rooms can contain any large number of Users that don't need to interact with each others besides private messages. Things like UserVariables, RoomVariables, Public Messages etc... are all disabled.
The reason is that with large amount of Users this would involve massive broadcast of messages resulting in heavy usage of the bandwidth etc...