I have a problem and need your help plz
I need to connect via a Html5/javascript script to SFS2X and send request to it.
I try to connect to SFS2X via HTML 5 and Javascript but after a while i get an error message "Connection failed: Is the server running at all?"
However the logs show that server answered and created a session during this while :
Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ]
Listening Sockets:
{ 127.0.0.1:9933, (Tcp) }
{ 127.0.0.1:9933, (Udp) }
{ 127.0.0.1:8888, (Tcp) }
{ 127.0.0.1:8888, (Udp) }
{ 127.0.0.1:8888 (WebSocket) }
28 janv. 2014 15:26:45,866 Session created: { Id: 7, Type: DEFAULT, Logged: No, IP: 127.0.0.1:49970 } on Server port: 8888 <---> 49970
28 janv. 2014 15:27:23,337 Session removed: { Id: 7, Type: DEFAULT, Logged: No, IP: 127.0.0.1:49970 }
Here is my code :
Code: Select all
var sfs = null;
function Connect(){
sfs = new SmartFox();
// Add event listeners
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION, onConnection, this);
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION_LOST, onConnectionLost, this);
sfs.connect("127.0.0.1",8888);
}
//------------------------------------
// SFS EVENT HANDLERS
//------------------------------------
function onConnection(event)
{
if (event.success){
trace("Connected to SmartFoxServer 2X!", true);
}
else {
var error = "Connection failed: " + (event.errorMessage ? event.errorMessage + " (code " + event.errorCode + ")" : "Is the server running at all?");
showError(error);
}
}
Thanks for answers and your help
PS i also did the test with Examples and same issue so i think it should probably come from the SFS2X server configuration
am i wrong ?