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!
Connecting without config XML
this is how i do it :
frame 1 on the timeline :
and then add all the callbacks.
Should work without problem.
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.
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!
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!
Re: Connecting without config XML
I have the same issue, As of now, in as3, you cannot control the blue box connection port
Re: Connecting without config XML
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
The SmartFoxServer Team
Return to “SFS2X ActionScript 3 API”
Who is online
Users browsing this forum: No registered users and 39 guests