usermanager.getuserbyname problem

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

usermanager.getuserbyname problem

Post 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 :)
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: usermanager.getuserbyname problem

Post by Lapo »

Sounds very weird. What server version and API version are you using?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: usermanager.getuserbyname problem

Post by itsmylifesoham »

sfs2x rc3 . as3 client, java server
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: usermanager.getuserbyname problem

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: usermanager.getuserbyname problem

Post 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
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: usermanager.getuserbyname problem

Post 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
Lapo
--
gotoAndPlay()
...addicted to flash games
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: usermanager.getuserbyname problem

Post 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.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: usermanager.getuserbyname problem

Post by itsmylifesoham »

Hi,

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

thanks.
:)
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: usermanager.getuserbyname problem

Post 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.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply