Connecting without config XML

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

Moderators: Lapo, Bax

Cloov
Posts: 8
Joined: 04 Oct 2011, 12:12

Connecting without config XML

Postby Cloov » 04 Oct 2011, 13:59

Hi all,

I couldn't find this question elsewhere but I imagine it's a common one:

We want to be able to perform a connect to SmartFox, in AS3, without first using the loadConfig method. I saw some possible approaches for doing this, but I couldn't get it to work. I used another of the connect methods, and passed host, port, and zone manually, but I didn't get connected to our SFS2X server, and I'm not sure why.

The reason we need to do this is that we will be using a load balancer for our SmartFox deployment solution, and amongst this, we will, at times, need to send users to a particular one of our running servers (probably by specifying its IP).

If we weren't able to connect without loading a config file first, we'd have to know the IP addresses of all our servers behind our load balancer (which might be a possibility), and choose to load one of, say, 8 XML files that each have a different one of our server host IP addresses - this would be far from ideal, and look like quite an ugly solution, but it's our backup plan.

Thanks for reading, any help's much appreciated!
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 04 Oct 2011, 15:38

this is how i do it :

frame 1 on the timeline :

var sfs:SmartFox;
var ServerIp:String = "myIP";
var ServerPort:int = 9933;
var Zone:String = "myZone";

btn_Connect.addEventListener (MouseEvent.CLICK, OnConnect_Click);

function OnConnect_Click (event:MouseEvent):void
{
Connect ();
}

function Connect ():void
{
lbl_Status.text = "Connection ...";
Security.loadPolicyFile("xmlsocket://myIP:9933");
sfs = new SmartFox (true);
sfs.connect(ServerIp, ServerPort);
addEventListeners ();
}


and then add all the callbacks.
Should work without problem.
Cloov
Posts: 8
Joined: 04 Oct 2011, 12:12

Postby Cloov » 22 Nov 2011, 12:53

We resolved this, thanks to this post, but we now have another question.

We're using the SFS2X 2.0.0.RC1b patch, and I know BlueBox changed in this release compared to the previous one, and I'm suspicious our BlueBox behaviour has changed since this patch, primarily in how we can control BlueBox from the AS3 client API for this SFS release.

More simply put - can anyone tell me how I can control the port BlueBox connects to - using the AS3 API - and without using a config XML file? i.e. using com.smartfoxserver.v2.SmartFox.connect(ip, host) directly, and with loading a policy file via Security.loadPolicyFile("xmlsocket://myip:myport"). Basically we're struggling with our control over BlueBox, and it seems that we're experiencing far more connections over BlueBox than we hoped. It would be good to be able to know (a) how to accurately log information from the client API to show whether bluebox is being used, or when it kicks in, or other details related to it such as the port it'll be using, and (b) whether we can change these at runtime, without loading config.xml, and if we can't, why this is the case.

Thanks!
superprat
Posts: 44
Joined: 07 Feb 2012, 20:55
Location: India

Re: Connecting without config XML

Postby superprat » 29 May 2013, 09:35

I have the same issue, As of now, in as3, you cannot control the blue box connection port
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Connecting without config XML

Postby Bax » 29 May 2013, 10:07

The upcoming API update will add the possibility to pass a config object via code, as an alternative to loading the xml one.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 22 guests