Page 1 of 1

Delayed Connection and Login

Posted: 03 Sep 2011, 20:26
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?

Posted: 03 Sep 2011, 20:36
by rjgtav
hi. Well, i think that the limit is the number of logged users, not the number of users that are just connected

Posted: 03 Sep 2011, 21:51
by lordzardeck
Actually, it says # of CCU's are equal to the number of connections

Posted: 03 Sep 2011, 23:28
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 :)

Posted: 04 Sep 2011, 01:04
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
}

Posted: 04 Sep 2011, 10:54
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).