Javascript client error
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Javascript client error
I am trying to use javascript client to connect my local smartfox server, but it failure, the server version is:2.9.0. Is the older version smartfox not supporting js client? The error as below:
- Attachments
-
- QQ图片20170717125727.png
- (23.93 KiB) Not downloaded yet
-
- QQ图片20170717125715.png
- (31.04 KiB) Not downloaded yet
-
- QQ图片20170717125651.png
- (24.19 KiB) Not downloaded yet
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error |waitting online
Is there anybody has the same error?
Re: Javascript client error
Websocket is configured on port 8888 but it seems your client is attempting to connect on 8080.
You should use 8888.
Thanks
You should use 8888.
Thanks
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
I just tried with port 8888, got the error "[SFS2X DEBUG]
Can't establish socket connection", please let me know if any information necessary
Can't establish socket connection", please let me know if any information necessary
Re: Javascript client error
1) Make sure you're using the right Javascript API.
In our download page we have two API for Javascript, one supports binary protocol (version 1.7.5) and requires the latest SFS2X 2.13
The other is version 1.7.1 and is compatible with all previous SFS2X versions.
http://www.smartfoxserver.com/download#p=client
Make sure to use version 1.7.1
2) Firewalls
Make sure there's no firewall blocking communication on port 8888.
If client and server are running on two separate machines, check them both as you might have a firewall blocking both sides
Let us know
In our download page we have two API for Javascript, one supports binary protocol (version 1.7.5) and requires the latest SFS2X 2.13
The other is version 1.7.1 and is compatible with all previous SFS2X versions.
http://www.smartfoxserver.com/download#p=client
Make sure to use version 1.7.1
2) Firewalls
Make sure there's no firewall blocking communication on port 8888.
If client and server are running on two separate machines, check them both as you might have a firewall blocking both sides
Let us know
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
Thanks for your reminder, i've replace the JAVAscript API with version "1.7.1". Now the error is become as "WebSocket connection to 'ws://127.0.0.1:8888/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED".The code is like this:
Code: Select all
var sfsConfig = {};
sfsConfig.host = "127.0.0.1";
sfsConfig.port = 8888;
sfsConfig.zone = "Generic";
sfsConfig.debug = false;
var sfs;
//------------------------------------
// USER INTERFACE HANDLERS
//------------------------------------
function onConnectBtClick()
{
// Clear log window
document.getElementById("log").innerHTML = "";
// Disable interface
enableInterface(false);
// Log message
trace("Connecting...");
// Create SmartFox client instance
sfs = new SFS2X.SmartFox(sfsConfig);
sfs.logger.level = SFS2X.LogLevel.INFO;
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION, onConnection, this);
sfs.addEventListener(SFS2X.SFSEvent.CONNECTION_LOST, onConnectionLost, this);
//sfs.addEventListener(SFS2X.SFSEvent.LOGIN, onLogin, this);
//sfs.addEventListener(SFS2X.SFSEvent.LOGIN_ERROR, onLoginError, this);
// sfs.addEventListener(SFS2X.SFSEvent.EXTENSION_RESPONSE, onExtensionResponse, this);
// Attempt connection
sfs.connect();
}
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
BTW, the server and client are in the my local machine , meanwhile I've close the firewall in my local.
Re: Javascript client error
In your first screenshot you have WSS protocol active.
You should disable it for local testing.
You should disable it for local testing.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
Thanks for your help, now I am able to connect SFS server, but login failure. Is there any help document for JS Client API-1.7.1?
Re: Javascript client error
This is the legacy JavaScript API doc: http://docs2x.smartfoxserver.com/api-do ... ient-json/
Can you better explain what error you get?
Can you better explain what error you get?
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
I deeply appreciate your help.It's my fault, i was follow the example which is using version 1.7.5, but include 1.7.1 version client api in the project.That's why I am asking for the document, it's really useful for us .
Re: Javascript client error
We strongly recommend that you move to SmartFoxServer 2X v2.13 and the new JavaScript API.
Is there a specific reason why you are still using the old version?
Is there a specific reason why you are still using the old version?
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
Some of legacy game are still running in older version and we are going to upgrade the server version in 1-2 months.
-
- Posts: 50
- Joined: 06 Dec 2016, 06:27
Re: Javascript client error
If I upgraded the server which is prior to v2.9.0, I have to reinstall the server. Is the only way to do it?
Re: Javascript client error
steve13627 wrote:If I upgraded the server which is prior to v2.9.0, I have to reinstall the server. Is the only way to do it?
Yes. Then you can move your Extension to the new installation.
As it regards the server and Zone/s configuration, we recommend to rebuild it using the AdminTool, as some issues may arise if you just move the xml files from the old version to the new one.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Who is online
Users browsing this forum: No registered users and 120 guests