all groups > macromedia flash flashcom > may 2007 >
You're in the

macromedia flash flashcom

group:

Trap The Duplicate Logging On FMS, LoggOff Old One And Accept New Instance.


Trap The Duplicate Logging On FMS, LoggOff Old One And Accept New Instance. winshi
5/22/2007 12:00:00 AM
macromedia flash flashcom:
Hi All,

I need help on the following topic of FMS 2.0.

On FMS Server I want to trap the duplicate logging, Logoff Old One and accept
New Instance.

The scenario is like this, if a user logged in with the name ?[b]wins[/b]? on
FMS Application from his Office, after some time he came to his home and want
to logging again.
I want to disconnect or logoff the instance of application which is logged in
from his Office and allow him to logging from his home.

Actually I want to implement the functionality like [b]Yahoo messenger[/b].
Yahoo messenger gives the facility to login from another system and logoff the
previous instance.

So, tell me what I have to do to achieve this.

Thanks

Re: Trap The Duplicate Logging On FMS, LoggOff Old One And Accept New Instance. abeall
5/24/2007 3:28:26 PM
onAppStart intitialize an object to hold all connected clients, maybe called
userList:
application.onAppStart = function(){
this.userList = {};
}

Then when someone logs in, they of course pass in their username. Simply put
that client in userList by its username.
application.onConnect = function(newClient, username){
this.acceptConnection(newClient);
this.userList[username] = newClient;
}

Then you can easily modify that code to boot the old client if that username
is already in use:

application.onConnect = function(newClient, username){
if(this.userList[username]){
this.disconnect(this.userList[username]);
}
this.acceptConnection(newClient);
this.userList[username] = newClient;
}

See if that works for ya.
Re: Trap The Duplicate Logging On FMS, LoggOff Old One And Accept New Instance. winshi
5/25/2007 6:03:55 AM
Hi Abeall,

Thanks for this,

I had already solved this problem with the same process.
But your code is much [b]optimized[/b] so i am going to recode the main.asc as per your code.

Thanks,
AddThis Social Bookmark Button