Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby nik0990 » 06 Jun 2018, 07:51

Hi,

I am doing one task to improve user look and feel. For that i need to store data in DB and than that data will fetch each time when Player do any activity. So I am trying to do this by USER_VARIABLE.

Is this safe to store data in user_variable?
Did we need to store user preferences in user_variable?
Or
Can we update SFS2x Object by other server call?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby Lapo » 06 Jun 2018, 08:11

Hi,
I am not sure what you mean by "safe"? Safe as in secure?
UserVariables by default are transmitted to all other players in the Room, so if you have values that you want to keep private you will need to make the UserVariable private so that only its owner will see it.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby nik0990 » 06 Jun 2018, 08:20

Thanks for quick reply,

Yes safe means secure.

That means i will get uservariables in all rooms where player go and can I update private user variable(Updation done by Client)?

But still i having one question.
Can i update SFS2x Player uservariable from other server(like Tomcat)?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby Lapo » 06 Jun 2018, 08:28

nik0990 wrote:Yes safe means secure.
That means i will get uservariables in all rooms where player go and can I update private user variable(Updation done by Client)?

Yes you can update variables from client side or server side.

But still i having one question.
Can i update SFS2x Player uservariable from other server(like Tomcat)?

In theory you could but it's kind of complicated to implement because you need Tomcat to call an SFS2X servlet via HTTP.
The servlet then should call the Extension which should change the variables.

Can you explain a bit more what you're trying to do? Maybe there is an easier way.
Also SmartFoxServer 2X runs its own servlet container (Jetty), so maybe you could use that instead of Tomcat? For better integration I mean.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby nik0990 » 06 Jun 2018, 08:57

I have one project in tomcat and i will integrate few rest API calls to that project.(It is place some where else)

Now I need to update user preference and than preform action for that i need to get user preference on every event from DB.
To optimize this i want to use USER_VARIABLE and want to update it on run time.

Example:
Player Change some his/her preferences and this API call to tomcat server and this API insert/update player preference in DB.
SFS2x(Game Server) will read this preference on every event(like take seat,leave seat etc) from DB. To minimize/optimize this I want Tomcat server to update SFS2x player USER_VARIABLES.

If this is possible Please give me the way to do it.

Or This is the good idea or not to update SFS2x user_variable from other server(tomcat)?

Thanks in advance
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby Lapo » 06 Jun 2018, 13:42

Why not using SmartFoxServer for this logic?
The client could send the new preferences to the SFS2X Extension which would update the DB and the UserVariables.

You would save a good number of steps and it would be simpler (and faster).

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: Can I use USER_VARIABLE to store data and Is it available throughout the login and is it Safe?

Postby nik0990 » 07 Jun 2018, 06:35

Thinking the same.

Thanks

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 80 guests