Problem when getting user lastJoined room

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

Moderators: Lapo, Bax

Alex
Posts: 131
Joined: 03 Sep 2006, 09:15

Problem when getting user lastJoined room

Postby Alex » 12 Aug 2010, 07:18

Hi

When I access user.getLastJoinedRoom during user disconnect, the room is always null. I've tried the following:

Code: Select all

addEventHandler( SFSEventType.USER_DISCONNECT, SrhUserDisconnect.class );

public void handleServerEvent( ISFSEvent event ) throws SFSException
{
   Room room = ( SFSRoom )event.getParameter( SFSEventParam.ROOM );
   User user = ( SFSUser )event.getParameter( SFSEventParam.USER );
}            


Both room and user.getLastJoinedRoom() are null.

p.s. The room is created by the server and it is set as dynamic.

Is there another way to get the user last joined room?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Aug 2010, 13:18

You are posting too quickly :)
Please check the docs, although they are in beta they can can help quite a bit. There's no ROOM parameter for that event and of course you cannot expect to find the lastJoined Room attribute from a disconnected User because he has just left all the Rooms ;)

However the event sends you the missing informations via other parameters:
http://showcase.smartfoxserver.com/2X-P ... DISCONNECT
Lapo
--
gotoAndPlay()
...addicted to flash games
Alex
Posts: 131
Joined: 03 Sep 2006, 09:15

Postby Alex » 12 Aug 2010, 14:56

Hi

Sorry about that :(
I'm under pressure to finish porting an existing sfs 1.6 project to 2.x and I have a dead line which is closing so I panic easily.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Aug 2010, 15:51

I see, too much pressure is never good...
Let us know how it goes with the work. At the speed you are going it seems that this will probably be the first official SFS1 to SFS2X port :)
Lapo

--

gotoAndPlay()

...addicted to flash games
Alex
Posts: 131
Joined: 03 Sep 2006, 09:15

Postby Alex » 13 Aug 2010, 04:21

10x for the support - I'll keep you informed about my progress :D
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 13 Aug 2010, 08:30

If for nothing else, it makes for great testing and some good questions :-)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 52 guests