Disconnect vs Logout

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

rparker
Posts: 19
Joined: 18 Oct 2010, 09:10

Disconnect vs Logout

Postby rparker » 18 Oct 2010, 09:17

Hello,

I was wondering if there was anyway for a server extension to detect the difference between a disconnect and a logout. I know we get an event when a user logs out, but I need to know if they disconnect and not just log out of a zone.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 18 Oct 2010, 18:43

Yes,

You can capture both logout and disconnect internal events.

Disconnect --> http://www.smartfoxserver.com/docs/docPages/serverSideApi/internalEvents/userLost.htm

Logout --> http://www.smartfoxserver.com/docs/docPages/serverSideApi/internalEvents/logOut.html

By the way, only one of these can be triggered for each client. For instance, if the logout internal event was triggered - the disconnect event wont.

Both these internal events can be used in zone and room level extension
Smartfox's forum is my daily newspaper.
rparker
Posts: 19
Joined: 18 Oct 2010, 09:10

Postby rparker » 19 Oct 2010, 01:25

So does that mean I choose. If want to listen for disconnect only, that will always work? Meaning, in this case, I don't really care about logout at all, just disconnect.
rparker
Posts: 19
Joined: 18 Oct 2010, 09:10

Postby rparker » 19 Oct 2010, 02:04

Just to clarify, if possible I would like to know specifically when a disconnection occurs, planned or unplanned does not matter. I do not want to know when a user has logged out of a zone and has not actually closed the connection to the server.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 19 Oct 2010, 02:33

Sorry if I wasn't clear.

The server dispatch both disconnect (userLost) and logout internal event regardless whether or not you're listening for it.

So, if a user had logged out - the disconnect internal will not be triggered, but the logout internal event will.

And when a user had disconnected, the logout internal event will not be triggered but the disconnect internal event will.

So you should listen for both, and call the same external function from within both internal events.

As a side note, the disconnect internal event may not always be triggered straight away. See --> http://www.smartfoxserver.com/forums/viewtopic.php?t=8272
Smartfox's forum is my daily newspaper.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 17 guests