Delayed Connection and Login

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

Moderators: Lapo, Bax

Post Reply
lordzardeck
Posts: 14
Joined: 03 Sep 2011, 13:39

Delayed Connection and Login

Post by lordzardeck »

What if I don't want a user to connect till they are ready to login? That way I don't get people just bringing up the game and using one of my limited connection slots? Is there anyway to delay connecting until logging in? I know I could add a onConnection Event listener that logs you in, but how would I remove that event listener so that if I get disconnected and try to re-connect that it doesn't call the login listener again?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

hi. Well, i think that the limit is the number of logged users, not the number of users that are just connected
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
lordzardeck
Posts: 14
Joined: 03 Sep 2011, 13:39

Post by lordzardeck »

Actually, it says # of CCU's are equal to the number of connections
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

I don't get it.

You want user to login but don't want him to connect to server :S

How would this happen?

He need to interact with something to validate his user/password?

It either socket server or http server.


In casse you choose http server, then don't connect until he login?

I don't see where the problem is?

Sorry :)
---------------------------------------------------
Jamal Soueidan
http://linkedin.com/in/jamalsoueidan
lordzardeck
Posts: 14
Joined: 03 Sep 2011, 13:39

Post by lordzardeck »

jamalsoueidan wrote:I don't get it.

You want user to login but don't want him to connect to server :S
Not quite. I don't want to connect to the server until he actually ATTEMPTS to log in. for example:

Code: Select all

public function login(username:String, password:String):void
{
	//do connection
        //do login
}
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

lordzardeck wrote:Actually, it says # of CCU's are equal to the number of connections
Well, CCU's stands for Concurrent Users, and a player only becomes an user after a successful login ;-)

Anyway, I don't understand where the problem is.

In your login function, you simply first load the config by using the loadConfig() method of the SmartFox class, which automatically connects after successfully loading the config file.

Then, you listen to the CONNECTION event and there, you send a login request (if the connection was successful, of course).
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Post Reply