User variables for user only

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

Moderators: Lapo, Bax

karfau
Posts: 25
Joined: 02 Sep 2011, 17:28

Postby karfau » 04 Feb 2012, 13:04

:D This sounds great!
User avatar
Flying_Banana
Posts: 42
Joined: 04 May 2014, 07:03

Re: User variables for user only

Postby Flying_Banana » 27 Jun 2015, 19:31

Not intentionally gravedigging but - is there progress on this? I also find this very convenient (as I'd like to sync things from server to user that other users need not to know) I'm just wondering should I leave this for later in hope that the next update will contain this feature? :)
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 29 Jun 2015, 08:43

How should this work?
Server --> Client only or also the other way around?

If clients can override server's values there could be some cheating involved.
One way to work around the issue could be to use the ReadOnly filter as explained here:
viewtopic.php?p=66625#p66625

We're thinking about building this feature as a System Controller filter instead of modifying the client/server API, as this would avoid breaking the compatibility of the API with previous versions of the server.

In other words, one could add a specific PrivateUserVariable filter in his Extension and provide the names of the variables to be treated as "private". The filter will detect those and update only the owner, instead of everyone.

The analysis is not done yet, so I am just thinking out loud :)
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Flying_Banana
Posts: 42
Joined: 04 May 2014, 07:03

Re: User variables for user only

Postby Flying_Banana » 30 Jun 2015, 15:19

I was thinking of it being just server to user really. I realised that to prevent cheating I have to filter every user input with an extension. Having private user variables as a flag could be useful to relay data easily. I have to say, by far the user variables design is the best I've worked with so far! (I've had enough with blocks, callbacks, and fetches! I want the data now! :) )

Well then I think it is the time I start to look at filters! (But I still think a private flag would be so very convenient!)
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 30 Jun 2015, 15:46

The problem with the "private" flag is that it impacts the server and client API in a way that it makes it no longer possibile to mix up older clients with new server or viceversa.
In other words, if we release new client API we must force developers to upgrade their servers too.

At the moment I am thinking of a way to work around this issue by providing a filter that allows the same result using a slightly different system. Instead of flagging variables with a private flag you tell the server-side filter which names represent the private User Vars.

In terms of coding it shouldn't be more painful than flagging each variable.

The filter idea would also speed up the process as we don't have to worry about backward compatibility and run tons of tests. Maybe at a later time we could introduce the feature via the "private" flag. If we choose to do so, users of the previous system (filter) will be able to keep the filter if they want or update their code to the new system.

Another nice-to-have option could be a Zone-level config setting saying if the server can accept changes of private UserVars from clients or not, with a default value of false.

How does that sound?
Lapo

--

gotoAndPlay()

...addicted to flash games
karfau
Posts: 25
Joined: 02 Sep 2011, 17:28

Re: User variables for user only

Postby karfau » 01 Jul 2015, 08:06

Great for me
User avatar
Flying_Banana
Posts: 42
Joined: 04 May 2014, 07:03

Re: User variables for user only

Postby Flying_Banana » 05 Jul 2015, 13:05

Alright, I'll check the filters and try a workaround.

That being said, since this is a server thing, shouldn't it not affect users who don't upgrade though? Because servers that don't upgrade will never worry about this flag, and client api will never have to worry about the flag either because it never receives a flagged variable.

I guess unless someone tries to code in the new api but still use an older version of api on the actual server - but that's just silly...
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 06 Jul 2015, 06:44

Good point, if it's a server-side thing only, both flag-system and filter-system will work equally well.

There's even a third route which is extending SFSUserVariable to SFSPrivateUserVariable, to differentiate which variables should behave normally and which should be treated as private.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
tdanylchuk
Posts: 10
Joined: 17 Jun 2016, 13:12

Re: User variables for user only

Postby tdanylchuk » 17 Jun 2016, 13:17

Hello,

Same issue I have. But sending variables via push extension response is not a case for me since user need to have up-to-date data even if he had been disconnected...

So my question: Is there any updates on "todo list"???

I might have over 1k users in one single room and they will receive variable updates per second. So each client instance will de-serialize all unneeded events...

BR, Taras
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 17 Jun 2016, 15:08

tdanylchuk wrote:Hello,

Same issue I have. But sending variables via push extension response is not a case for me since user need to have up-to-date data even if he had been disconnected...

Sorry, I am not following. What is "push extension response"?
Also the part about having up to data when the user is confusing. If the user is disconnected it goes without saying that no updates will be possible.

I might have over 1k users in one single room and they will receive variable updates per second. So each client instance will de-serialize all unneeded events...

For what reasons are these 1K users in a Room? What feature of the Room are you using?
More often than not when you need to cram so many users in a Room but you don't want broadcast updates, you don't need a Room to begin with, which is perfectly fine. :)

Please clarify.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
tdanylchuk
Posts: 10
Joined: 17 Jun 2016, 13:12

Re: User variables for user only

Postby tdanylchuk » 21 Jun 2016, 08:33

but you don't want broadcast updates

I'm actually broadcasting messages over all users in one room and also via groupId(isGlobal = true) for room group. But these are ROOM variables, as for my case I need to have personal user's variable update, so no other users know them in joined room.

BR, Taras
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 21 Jun 2016, 14:52

Ok, thanks for the clarification.
We don't have a timeline for this particular feature, although I think it should be included in the next release (2.12).

You can already implement this via Extension calls, by sending those values via SFSObject directly to the client(s).

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
tdanylchuk
Posts: 10
Joined: 17 Jun 2016, 13:12

Re: User variables for user only

Postby tdanylchuk » 21 Jun 2016, 16:22

Thank you, good changes are coming up in new release :)

By the way, I'm sending variables via extension response now, but I want send them in my custom wrapper like:

Code: Select all

byte[] variables;
CustomObject data = CustomObject(variables);
SFSObject sfsObject = new SFSObject();
sfsObject.putClass("data", data);


But instead of converting to byte array I want to put SFSArray in my custom object, in this case error message occures in log.
So question is - Why can't I use SFSArray and SFSObject in my custom classes? Only SerializableSFSType and primitives...

PS: BTW when this version will be released? Because I need to have this state in user variables in case of reconnect...

BR, Taras.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User variables for user only

Postby Lapo » 22 Jun 2016, 07:36

Sorry you can't mix SFSObject/SFSArray with your own classes.
Instead just use any standard collection, such as List or Set. They do the same work that SFSArray does by the way :)

We don't have a release date for the release at the moment. There is still a lot of to do as we're also working on some major updates.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
tdanylchuk
Posts: 10
Joined: 17 Jun 2016, 13:12

Re: User variables for user only

Postby tdanylchuk » 22 Jun 2016, 07:55

Thank you again for your feedback.

To bad that I can't mix these stuff...
It's very easy to use - user variable convert to SFSArray and send it, instead of converting to byte array (double conversion).
And by the way, JSON transition doesn't work properly for custom objects, other primitives work fine i guess.

BR, Taras.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 94 guests