Custom Login and onJoinRoom event

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
kleelof
Posts: 33
Joined: 11 Oct 2008, 02:22

Custom Login and onJoinRoom event

Post by kleelof »

Hello,

I have a Zone set-up for custom login and within this zone is a 'lobby' that is set for autoJoin. I never send any joinRoom commands from the client or server.

When the user logs in, everything seems to go well except my client is not responding when the room is joined. I can see in the Flash IDE that it is receiving the 'joinOK' message. Is this what triggers the onJoinRoom event?

take care,
lee
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

If you don't call autoJoin() from client side the room will never be auto-joined.
If you prefer you can perform it from the server side:
1. Perform login logic
2. Send the Room List ( via sendRoomList() )
3. Join the Room
Lapo
--
gotoAndPlay()
...addicted to flash games
kleelof
Posts: 33
Joined: 11 Oct 2008, 02:22

Post by kleelof »

Hello,

I have it set-up as you described. Here is what I am seeing in the Flash IDE:

onRoomListUpdate
[Sending]: <msg t='sys'><body action='autoJoin' r='-1'></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='1'><pid id='0'/><vars /><uLs r='1'><u i='7' m='0'><n><![CDATA[kleelof]]></n><vars></vars></u></uLs></body></msg>, (len: 150)
[ RECEIVED ]: <msg t='sys'><body action='uCount' r='1' u='1'></body></msg>, (len: 60)

However, it does not seem to be triggering the onJoinRoom event. It is registering in the server-side script as well as the SFS Admin Tool.

I've checked that the event handler is in place.

take care,
lee
kleelof
Posts: 33
Joined: 11 Oct 2008, 02:22

Post by kleelof »

Hello,

Ok, I found the problem. I was killing the eventListener too early. As usual, it works perfectly now.

thanks,
lee
Post Reply