Hi,
Is it possible to determine if a user was logged out based on a forced logout condition? In other words, if a user logs in and that forces the logout of another client, is there a way to identify this through a Logout or Disconnect Event?
In this case, I would like to have my application show a dialog stating that the user was logged out because they logged in elsewhere.
Thanks!
Forced Logout Question
Re: Forced Logout Question
Hello.
Currently, when you're disconnected due to the forceLogout feature, you only get a CONNECTION_LOST event with reason set to unknown, and you are neither able to customize it nor to distinguish it from a "normal" disconnection. That said, as a workaround, you could disable the force logout and before you login the new user, you check if there is other already logged in. If there is, you send it a small packet with a simple command (which will mean that the client was kicked because of the multiple login) and then disconnect the user.
Maybe this could be a feature request, to implement a new DisconnectionReason for when you are disconnected due to the forceLogout system.
Currently, when you're disconnected due to the forceLogout feature, you only get a CONNECTION_LOST event with reason set to unknown, and you are neither able to customize it nor to distinguish it from a "normal" disconnection. That said, as a workaround, you could disable the force logout and before you login the new user, you check if there is other already logged in. If there is, you send it a small packet with a simple command (which will mean that the client was kicked because of the multiple login) and then disconnect the user.
Maybe this could be a feature request, to implement a new DisconnectionReason for when you are disconnected due to the forceLogout system.
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.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: Forced Logout Question
You mean on client or server side?
On the server side you do get a disconnection event so you can check who was disconnected. On the client this is not possible.
On the server side you do get a disconnection event so you can check who was disconnected. On the client this is not possible.
Re: Forced Logout Question
Thanks for the responses.
To answer your question, similar to the existing reason codes returned on a user disconnect (kick, ban, etc.). I'm trying to come up with a way to determine (on the client) that a user was logged out because they logged in somewhere else. So let's say I'm logged in from my laptop. With force login configured, if I then log in from my desktop PC using the same user, my laptop gets logged out. I would like the laptop client to recognize this condition. Not simply that I was logged off, but that it was the result of logging in someplace else.
To answer your question, similar to the existing reason codes returned on a user disconnect (kick, ban, etc.). I'm trying to come up with a way to determine (on the client) that a user was logged out because they logged in somewhere else. So let's say I'm logged in from my laptop. With force login configured, if I then log in from my desktop PC using the same user, my laptop gets logged out. I would like the laptop client to recognize this condition. Not simply that I was logged off, but that it was the result of logging in someplace else.
Re: Forced Logout Question
I am sorry, this is not supported.
Also, in general, it would make little sense IMHO. You normally don't want clients to remain idle for hours and hours. SFS2X already provides a disconnection mechanism for idle clients. This means that, in your described scenario, you will probably disconnected by the server before you attempt a new login from some other place.
When this happens, the client is actually given a disconnection reason. On the other hand when you login from some other place this is not possible, because it involves sending a message to the other client and delaying the new user's login.
I will add a note in our to-do list for future improvements.
Thanks
Also, in general, it would make little sense IMHO. You normally don't want clients to remain idle for hours and hours. SFS2X already provides a disconnection mechanism for idle clients. This means that, in your described scenario, you will probably disconnected by the server before you attempt a new login from some other place.
When this happens, the client is actually given a disconnection reason. On the other hand when you login from some other place this is not possible, because it involves sending a message to the other client and delaying the new user's login.
I will add a note in our to-do list for future improvements.
Thanks
Re: Forced Logout Question
Well, it does make sense if you do not want the user to open two browser windows and play against self. Alternative (custom login) seems to be too much just for this.
Too bad.
Too bad.
Re: Forced Logout Question
I don't understand your comment.
A user can register two accounts and play against himself. To avoid this you must enable the IP filter and allow only one connection per IP.
This also comes with some side effects: you can never say if two connections coming from the same IP address are from the same player or not. Imagine an office or a school where dozens of people have access to the internet, all from the same IP.
A user can register two accounts and play against himself. To avoid this you must enable the IP filter and allow only one connection per IP.
This also comes with some side effects: you can never say if two connections coming from the same IP address are from the same player or not. Imagine an office or a school where dozens of people have access to the internet, all from the same IP.
Re: Forced Logout Question
And what if two accounts for the same user are OK but playing against self is not?
Re: Forced Logout Question
Hi.
In that case, you have to store the user's display name as an UserVariable, and then you could login your users as guests, so they would get their unique guest username.
Isn't a player logged in multiple times with the same account considered as cheating?
In that case, you have to store the user's display name as an UserVariable, and then you could login your users as guests, so they would get their unique guest username.
Isn't a player logged in multiple times with the same account considered as cheating?
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.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.