I'm working on a project in Haxe which requires a connection to the SmartFoxServer. I installed SFS Pro (localhost:8080 opens and displays the intro page fine). I haven't modified the config files either.
Client-side, I try running SmartFoxClient.connect([my ip], 9339)
. After the line with connect
, nothing runs and the listener SFSEvent.onConnection
is never called.
import it.gotoandplay.smartfoxserver.SmartFoxClient;
import it.gotoandplay.smartfoxserver.SFSEvent;
class New {
public static function main() {
var sfs = new SmartFoxClient(true);
haxe.Log.trace(sfs.properties);
sfs.addEventListener(SFSEvent.onConnection, function(e:SFSEvent) {
haxe.Log.trace("Listener called: " + sfs.getConnectionMode);
if(e.params.success) {
haxe.Log.trace("Success");
}
else {
haxe.Log.trace("Success");
}
});
try{
haxe.Log.trace("Connecting Started..");
sfs.connect("192.168.1.229", 9339); //my ip is 192.168.1.229 on the internal network. Tried with "127.0.0.1" and got the same result
haxe.Log.trace("Connecting...");
}
catch(e:String) {
haxe.Log.trace("Failed");
}
haxe.Log.trace("Connection Sent..................");
}
}
I compile with haxe -main New -swf whatever.swf -swf-lib SmartFoxClient.swf -swf-lib SFSEvent.swf
. The compilation runs fine, but the output of the traces is only `sfs.properties (which is null) and "Connecting Started.."
I tried using the similar code in Flash (that is the same exact functions) and it connected fine.
My question is if anyone has done this without porting the entire code of SFS to Haxe (which I unsuccessfully tried with as3hx), what did they do differently?