limbo setUserVariables

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

limbo setUserVariables

Postby corwin » 28 Dec 2009, 09:00

Hi, first of all, Merry Christmas. :)
Second - we have an application with lobby, where all users stay, even when they play in other rooms. As the number of users grew, we decided to make that lobby limbo. But after that "something" stopped working. After some investigation we saw that that sfs.setUserVariables gives null pointer exception. We moved setting user variables to the server side, but i couldn't find in the documentation, why the client can't set user variables when user is only in limbo room..
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 29 Dec 2009, 07:54

Hi,
thanks and happy holidays to you too :)

As regards the Limbo Room issue this is expected because Limbo Rooms suppress all broadcast-type event, including public messages, room variables and user variables.

The characteristics of each Room type is described in details here:
http://www.smartfoxserver.com/docs/docP ... ecture.htm
Lapo
--
gotoAndPlay()
...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 30 Dec 2009, 08:11

Yes, I read the docs - it is normal the broadcast to be suppressed, but we event can't set the user variable from the client. :)
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 30 Dec 2009, 09:55

Exactly, all messages which involve broadcasting to multiple users are suppressed. Users in a Limbo Room have no notion of other clients in the same place. This allows to suppress all the frequent updates and allow thousands of users in the same Room.

The usefulness of a Limbo Rooms becomes clear when you pair it with the Buddy List which allows users to know about each other and communicate without having to know the full list of users and being updated about the state of each one.

Also Buddy Variables can substitute regular User Variables.

Make sure to check the documentation, Chapters 6.10, 8.16 and the SmartMessenger tutorial to learn all the features in greater detail.
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 30 Dec 2009, 10:05

Ok, thanks.
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Postby Carl Lydon » 26 Jul 2011, 05:33

The problem with this is I normally set the user's location in the room before the user joins the new room, so the avatars will appear in the right spot once the userlist comes in.

This doesn't work when going from a Limbo room, since it gives me an error that halts my program.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 26 Jul 2011, 06:40

You could always use sendXtMessage to tell the server to update the user's variable and then join the room, based on the parameters sent from the client.
Smartfox's forum is my daily newspaper.
User avatar
Carl Lydon
Posts: 298
Joined: 12 Nov 2007, 16:15
Location: NYC
Contact:

Postby Carl Lydon » 27 Jul 2011, 18:20

I could, but that seems like a big production, to make a special case just because I'm leaving a limbo room. Is this the same in Smartfox 2.0?

It makes sense that vars are not broadcast when a limbo room, but it does not follow as a consequence that those same values should not be settable given that they do persist and exist. I can think of many, many scenarios where you might want to change a user variable even though you are in a Limbo room where nobody would see the change immediately.

I tend to use server - side user properties instead of user variables for many things because they're more secure and because user variables have many problems. There's quite a lack of control with user variables and this is one example.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 28 Jul 2011, 17:04

User Variables have a defined scope and rules that governs them, for all the rest server side code can be used to create custom behaviors.

In SFS2X you can fine tune the type of events fired by each Room so you can create Limbo-like Room that don't suppress all events. You can check the product for free, so I encourage to take a look at the docs and the downloadable trial
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 42 guests