SetUserVariables is Called before AddUser

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

Moderators: Lapo, Bax

Hassan Khallouf
Posts: 41
Joined: 06 Jul 2017, 04:35

SetUserVariables is Called before AddUser

Postby Hassan Khallouf » 23 Dec 2018, 18:00

Hello everyone, we are facing a problem in our game, the SetUserVariables method is being called before AddUser in the client SDK
Here is the full story:
we are using Smartfox 2.13.4 with the latest SDK for C# unity, we are facing a problem where most user variables are null when the user reaches the lobby, but it's ONLY on our WebGL build and it's NOT consistent, so I thought it's a race condition or something, today I decompiled the client SDK and put traces every where to help me hunt the issue

I found that the method called FnSetUserVariables in SystemController class is being called before the SFSUserManager.AddUser method, which will cause the following message to be debugged as warning in the browser's console:
UserVariablesUpdate: unknown user id = xxxxx

We are doing custom login, reading some values from the DB and then we set them in the session object
later on JoinZoneEventHandler we add all values to a variables list and send use the API object to set the user vars

the last thing we do in this event handler is join the user to the lobby or the main room

we have no issues at all on mobiles phones which what got me confused and looking in the wrong direction for so long, is this a correct order to do things?

Notes:
1- if I try to debug the user variables later (after the user has settled in the lobby, after 30 seconds for example), the user is there and it has only part of the variables

2- some times there is no issue at all and it just works!

3- the user has all his variables assigned correctly in the admin tool in all scenarios

almost all web users can't play due to this issue, if you can help we will appreciate it

my thanks
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SetUserVariables is Called before AddUser

Postby Bax » 24 Dec 2018, 08:53

Thank you for reporting.
We will investigate the issue during the next days and let you know.
Paolo Bax
The SmartFoxServer Team
Hassan Khallouf
Posts: 41
Joined: 06 Jul 2017, 04:35

Re: SetUserVariables is Called before AddUser

Postby Hassan Khallouf » 24 Dec 2018, 10:43

thanks Bax, let me know if there is any info you need to help
by the way the problem is WAY LESS frequent on firefox, but it still happens sometimes
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SetUserVariables is Called before AddUser

Postby Lapo » 24 Dec 2018, 11:04

Hassan Khallouf wrote:thanks Bax, let me know if there is any info you need to help
by the way the problem is WAY LESS frequent on firefox, but it still happens sometimes

Ouch. This might make the investigation more difficult. Which browsers did you use for testing? And which one seems to be affected the most?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Hassan Khallouf
Posts: 41
Joined: 06 Jul 2017, 04:35

Re: SetUserVariables is Called before AddUser

Postby Hassan Khallouf » 24 Dec 2018, 13:23

Chrome and firefox,
it happens on chrome most of the times, so our game is kinda completely broken if you use chrome
Hassan Khallouf
Posts: 41
Joined: 06 Jul 2017, 04:35

Re: SetUserVariables is Called before AddUser

Postby Hassan Khallouf » 03 Jan 2019, 10:10

Any clues so far? :D
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SetUserVariables is Called before AddUser

Postby Bax » 03 Jan 2019, 10:29

We yet can't reproduce the issue.
Can you please show how you execute the steps you described earlier?

- We are doing custom login, reading some values from the DB and then we set them in the session object

- later on JoinZoneEventHandler we add all values to a variables list and send use the API object to set the user vars

- the last thing we do in this event handler is join the user to the lobby or the main room
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Malcolmtaify, Stevenor and 43 guests