Getting at the User object after logging in but not joining

Post here all your questions related with beta SmartFoxServer API, such as Shockwave, Ajax ...

Moderators: Lapo, Bax

drh_qtm
Posts: 40
Joined: 15 Apr 2010, 09:07

Getting at the User object after logging in but not joining

Postby drh_qtm » 26 May 2010, 11:10

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
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 29 May 2010, 13:43

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
Lapo
--
gotoAndPlay()
...addicted to flash games
drh_qtm
Posts: 40
Joined: 15 Apr 2010, 09:07

Limbo rooms do not provide user variables though

Postby drh_qtm » 01 Jun 2010, 08:59

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)
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Jun 2010, 10:10

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...
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Other Client API”

Who is online

Users browsing this forum: No registered users and 2 guests