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.
Disconnect vs Logout
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
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.
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
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 32 guests