Disconnect and leaveRoom

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

Moderators: Lapo, Bax

louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Disconnect and leaveRoom

Postby louissi » 01 Nov 2011, 18:54

Hi Guys!
I am not really sure about something.

Lets say I have a room extension.

Will the USER_LEAVE_ROOM always be fired before USER_DISCONNECT?

In my game room, I have to make sure when a host leaves to make someone else the host.

However, I get this feeling USER_LEAVE_ROOM will not always be fired.
By example, when someone just closes his window.

Will that only fire USER_DISCONNECT, or USER_LEAVE_ROOM too?

Please answer this simple question fast, I am close to release lol
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 01 Nov 2011, 19:14

Hello.

Well, it looks like the USER_DISCONNECT event is somewhat like the USER_LOGOUT one.

If you check this topic, it seems that in SFS2X you no longer get the usual USER_LEAVE_ROOM event you used to get in SFS1X when an user lost connection.

So now you have to listen for the Zone-Level USER_DISCONNECT event.

If i'm wrong, please someone correct me :-)
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Postby louissi » 01 Nov 2011, 19:50

Isn't USER_LOGOUT fired only on Zone level?

My extension is Room Based.

My main question is: Is USER_LEAVE_ROOM always fired? Even if the client got disconnected? Logged out? Left the Room? Crashed? etc.

I need to know how to catch someone leaving my room every single time. What events will be fired at room level? Which one is always fired?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 01 Nov 2011, 19:59

Well, yes both USER_LOGOUT and USER_DISCONNECT are Zone-level events.

As you can see in the other topic, the USER_LOGOUT is fired instead of the USER_LEAVE_ROOM, so I assume that when an user disconnects, you also only get the USER_DISCONNECT event, as this event also has the joinedRooms property.

I need to know how to catch someone leaving my room every single time. What events will be fired at room level? Which one is always fired?


I can't check that right now and I'm not sure if you only get the USER_DISCONNECT or not :-(...
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Postby louissi » 01 Nov 2011, 21:26

USER_LEAVE_ROOM is definitely working...
in a Room extension at least ;)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests