Page 1 of 1

Disconnect and leaveRoom

Posted: 01 Nov 2011, 18:54
by louissi
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

Posted: 01 Nov 2011, 19:14
by rjgtav
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 :-)

Posted: 01 Nov 2011, 19:50
by louissi
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?

Posted: 01 Nov 2011, 19:59
by rjgtav
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 :-(...

Posted: 01 Nov 2011, 21:26
by louissi
USER_LEAVE_ROOM is definitely working...
in a Room extension at least ;)