Page 1 of 1

usermanager.getuserbyname problem

Posted: 20 Feb 2012, 14:19
by itsmylifesoham
hi,

i am stuck with a very weird problem.
i have made a simple private chat application.

scenario :
3 users are online(userid-1,userid-2,userid-3 are assigned by the sfsserver). all are able to ping each other and are receiving the messages. now user-1 gets disconnected due to idle user time expiry. He reconnects by pressing retry button which lets him reconnect to the private chat room again. Now the problem comes !

- when userid-2 or userid-3 try to ping him the message does not go! i debugged by method tht sends the message which is as follows :

Code: Select all

public function sendPrivateMessageTo(msg:String, sendToNickName:String):void
		{
			if(sfs.userManager.getUserByName(sendToNickName)!=null)
				sfs.send(new PrivateMessageRequest(msg,sfs.userManager.getUserByName(sendToNickName).id));
		}	
i found that after userid-1 reconnected he was given userid-4 . However when userid-3 tried to ping the reconnecteduser again, the above method was called and "sfs.userManager.getUserByName(sendToNickName).id" part was still giving id=1 !
i saw the server trace and it said :

"private message recipient not available" and hence the message was not going as userid-1 neva existed..

I dont understand why sfs.userManager.getUserByName(sendToNickName).id gave 1 instead of 4!

and more confusion occured when userid-2 was able to get the value of reconnected user's new userid as 4 which was expected.
however another client which was open in another tab (the userid-3) was getting this value as 2!

why was the usermanager not getting updated on userid-3 and was updated on userid-2 ?

any ideas will help :)

Re: usermanager.getuserbyname problem

Posted: 20 Feb 2012, 15:07
by Lapo
Sounds very weird. What server version and API version are you using?
Thanks

Re: usermanager.getuserbyname problem

Posted: 20 Feb 2012, 15:30
by itsmylifesoham
sfs2x rc3 . as3 client, java server

Re: usermanager.getuserbyname problem

Posted: 20 Feb 2012, 15:54
by Lapo
I need to know the version of the API.
Anyways... unless you are using some very old AS3 API this issue seems to be related to something else in your code.

My suggestion is: first check your client API and make sure they are at least >= 0.9.17 (btw, you could upgrade to SFS2X-Final, just released)
If the API are ok and you have a reproducible case, send us the FLA to test.

Thanks

Re: usermanager.getuserbyname problem

Posted: 20 Feb 2012, 16:25
by itsmylifesoham
thanks for the update,
its confusing, do i need to reinstall altogether after downloading the exe? or is there some updator like the one i got for rc3.

also where can i see the api version number? i got the new api folder with sfs2x rc3 upgrade, i use the same.

thanks :D

Re: usermanager.getuserbyname problem

Posted: 20 Feb 2012, 17:46
by Lapo
Since this is the final release we provide a full installer, so you will need to proceed with a new installation.
Next updates will be in the form of a patch.

As regards the API version, simply check the SmartFox.version property.
Example:

Code: Select all

var sfs:SmartFox = new SmartFox()
trace (sfs.version)
cheers

Re: usermanager.getuserbyname problem

Posted: 23 Feb 2012, 10:57
by itsmylifesoham
Hi Lapo,

I installed the new version and tried but the same problem!

i could not send you the whole code as its huge, so i have made a small app demonstrating the scenario with a readme file
to reproduce what i am seeing.

its a flex 4 app using robot legs mvc.

can download at :http://www.plunder.com/bug-report-downl ... CTWX5E.htm

thanks :)
-soham.

Re: usermanager.getuserbyname problem

Posted: 02 Mar 2012, 06:48
by itsmylifesoham
Hi,

just wanted to ask if this is a real problem or if i am doing something wrong.

thanks.
:)

Re: usermanager.getuserbyname problem

Posted: 02 Mar 2012, 08:58
by Lapo
Yes, I think there is something wrong.
In order to see the list of users in a certain Room you need to start from the Room object itself.

Code: Select all

var usersInThisRoom:Array = theRoom.getUserList()
The global userList property does not represent the Users in a certain Rooms and its mainly used internally by the API.