This is how I set it up:
1. In my server the jetty server is up and running in 8080, I can access the page in <SERVER_IP>:8080 which open up a web page with link to various place, including AdminTools.
2. I created the client config file named "dummy-config.xml" which contain :
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<SmartFoxConfig>
<ip>xx.xx.xx.xx</ip>
<port>9933</port>
<zone>xxxxxxx</zone>
<debug>true</debug>
<httpPort>8080</httpPort>
<useBlueBox>true</useBlueBox>
<blueBoxPollingRate>500</blueBoxPollingRate>
</SmartFoxConfig>
3. I load it from my code like so:
Code: Select all
private function init():void
{
sfs = new SmartFox(testing);
// Add event listeners
sfs.addEventListener(SFSEvent.CONFIG_LOAD_SUCCESS, onConfigLoadSuccess, false, 0, true);
sfs.addEventListener(SFSEvent.CONFIG_LOAD_FAILURE, onConfigLoadFailure, false, 0, true);
sfs.addEventListener(SFSEvent.CONNECTION, onConnection, false, 0, true);
sfs.addEventListener(SFSEvent.CONNECTION_LOST, onConnectionLost, false, 0, true);
sfs.addEventListener(SFSEvent.LOGIN_ERROR, onLoginError, false, 0, true);
sfs.addEventListener(SFSEvent.LOGIN, onLogin, false, 0, true);
sfs.addEventListener(SFSEvent.EXTENSION_RESPONSE, onExtensionResponse, false, 0, true);
sfs.addEventListener(SFSEvent.CONNECTION_ATTEMPT_HTTP, onConnectionAttempHTTP, false, 0, true);
}
private function onConnectionAttempHTTP(e:SFSEvent):void
{
D.info("Attempting connection through HTTP...");
}
private function onConfigLoadFailure(evt:SFSEvent):void
{
D.info( "Unable to load client configuration file" );
}
private function onConfigLoadSuccess(e:SFSEvent):void
{
sfs.connect(BuildSettings.APP_SERVER_URI, 9933);
}
public function login():void
{
D.info("Loading logging configuration");
sfs.loadConfig("dummy-config.xml", false);
}
As you can see, In normal condition I connect through IP from the code config (BuildSettings.APP_SERVER_URI). I assume after I set this all up, if the connection through socket (9933) failed, it will automatically switch to BlueBox (8080). Apparently it doesn't
I test it by blocking my 9933 port for outgoing connection (through Windows Firewall), which successfully block my app in connecting through the normal socket connection. But the problem is the BlueBox is not used, so even if I enable the BlueBox like I said before the app still can't connect to the server.
Is there something wrong in my steps, or maybe you guys could suggest me things to check ?
Thanks a lot.