Manage double login of same user
Posted: 06 Feb 2012, 02:11
Here I am again with another question.
I'm trying to "recover" a user already logged in SFS from another swf file, but I can not.
Let me explain.
I have two swf file that do exactly the same thing:
I open the first file, everything works and I see Wellcome .
Without closing the first file [/i] I open the second but I can not see Wellcome[/ i], the procedure does not go beyond the event OnConnection .
Rightly, the server locks the second file informing that the user is already logged in:
I'm fine but if I wanted to do a prior check to see if new_user is already logged in?
Before the instruction sfs.login ("test", "new_user", ""); [/ i] If user has already logged I proceed with further instructions, otherwise log in.
After connecting to the server, I tried to get a reference to the room_test Room, but, of course, the server replies that the room list is empty.
I need to do this because in the first swf file septum UserVariable I'll have to reread the second swf file and, if so, when switching from one file to another user gets disconnected or out of the room I lose the variables.
Thank you.
I'm trying to "recover" a user already logged in SFS from another swf file, but I can not.
Let me explain.
I have two swf file that do exactly the same thing:
Code: Select all
sfs = new SmartFoxClient(true);
sfs.addEventListener(SFSEvent.onConnection, onConnection);
sfs.addEventListener(SFSEvent.onRoomListUpdate, onRoomListUpdate);
sfs.addEventListener(SFSEvent.onJoinRoom, onJoinRoom);
sfs.connect("localhost", 9339);
private function onConnection(e:SFSEvent){
trace("onConnection");
sfs.login("test", "new_user", "");
}
private function onRoomListUpdate(e:SFSEvent):void{
trace("onRoomListUpdate");
sfs.joinRoom("room_test", "");
}
private function onJoinRoom(e:SFSEvent):void{
trace("Welcome!!!");
}Without closing the first file [/i] I open the second but I can not see Wellcome[/ i], the procedure does not go beyond the event OnConnection .
Rightly, the server locks the second file informing that the user is already logged in:
Code: Select all
User: new_user is already logged in Zone: test
Old user object found
Old User ID: 4
Old User IP: 127.0.0.1
bla bla bla bla
User was found in 1 room(s): room_test
Before the instruction sfs.login ("test", "new_user", ""); [/ i] If user has already logged I proceed with further instructions, otherwise log in.
After connecting to the server, I tried to get a reference to the room_test Room, but, of course, the server replies that the room list is empty.
I need to do this because in the first swf file septum UserVariable I'll have to reread the second swf file and, if so, when switching from one file to another user gets disconnected or out of the room I lose the variables.
Thank you.