Getting SFSUser by user id on server side

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

Moderators: Lapo, Bax

nimrodon
Posts: 2
Joined: 21 May 2017, 23:17

Getting SFSUser by user id on server side

Postby nimrodon » 21 May 2017, 23:33

Hi,
I'm developing server side extension in Java for my game. I'm not using the SFSRoom entity, instead I have my own rooms list.
I wish that my room info class would be independent of smartfox server. this is why I don't want to keep in it a reference of SFSUser. instead I would like to keep only user id, and when needed (like sending something to all users in the room), I will ask the server to give me the SFSUser by its id.
How can I get the SFSUser by Id? which Object has this method?


thanks,

Nimrod
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting SFSUser by user id on server side

Postby Lapo » 22 May 2017, 07:46

Hi,
you just need to get it from the Zone:

Code: Select all

User theUser = getParentZone().getUserById(value);


cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
nimrodon
Posts: 2
Joined: 21 May 2017, 23:17

Re: Getting SFSUser by user id on server side

Postby nimrodon » 24 May 2017, 16:04

thanks :)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 77 guests