Code: Select all
var config = {};
config.host = "100.200.100.200";
config.port = "10024";
config.useSSL = false;
var sfs = new SFS2X.SmartFox(config);
function onConnection(evtParams)
{
alert("test3");
if (evtParams.success)
console.log("Connected to SmartFoxServer 2X!");
else
console.log("Connection failed. Is the server running at all?");
}
function onConnectionLost(event)
{
alert("test2");
console.log("Disconnection occurred; reason is: " + event.reason);
}
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION, onConnection, this);
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION_LOST, onConnectionLost, this);
sfs.connect();
alert("test start");
The IP is invalid to test what happens if the connection can't be established.
Shouldn't be at least the event onConnection triggered?
Just "test start" is displayed on page load.
The console doesn't show errors except "[ SFS2X | ERROR ] Invalid TCP connection port: 10024".