SFS2X.LoginRequest is not a constructor.

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

SFS2X.LoginRequest is not a constructor.

Postby Ninjaoninja2 » 20 May 2018, 11:48

Hello,
This time I've used the search function for about an hour and haven't been able to come up with anything. :shock:

I think this actually might be a bug. When I'm trying to login, no matter how I send the request, it just says that SFS2X.LoginRequest is not a constructor, it was just working fine before the API update.

Here's my code:

Code: Select all

sfs.send(new SFS2X.LoginRequest(document.getElementById("Username").value, document.getElementById("Password").value, null, "SP"));

And yes, the dom elements I'm calling are in the index.html.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SFS2X.LoginRequest is not a constructor.

Postby Bax » 21 May 2018, 07:35

Can you please send a test case?
Because we tested the new API in all our examples, and they work as expected. No "not a constructor" error ever.
Maybe something else is going on?
Paolo Bax
The SmartFoxServer Team
Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Re: SFS2X.LoginRequest is not a constructor.

Postby Ninjaoninja2 » 21 May 2018, 13:30

Bax wrote:Can you please send a test case?
Because we tested the new API in all our examples, and they work as expected. No "not a constructor" error ever.
Maybe something else is going on?

I’ve been wondering that myself, I sent my code and the information to the support email.
parichaygauss
Posts: 4
Joined: 02 Nov 2018, 11:15

Re: SFS2X.LoginRequest is not a constructor.

Postby parichaygauss » 02 Nov 2018, 11:31

facing the same issue.
my code:
sfs.send( new SFS2X.LoginRequest("", "", "SimpleChat") );
i am trying to do system login.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X.LoginRequest is not a constructor.

Postby Lapo » 02 Nov 2018, 16:35

Hi,
can you specify which version of the API are you using?
Also can you show the entire function that surrounds that one line of code?
What browser are you testing with?

Are there any other libraries that you're using?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
parichaygauss
Posts: 4
Joined: 02 Nov 2018, 11:15

Re: SFS2X.LoginRequest is not a constructor.

Postby parichaygauss » 12 Nov 2018, 12:47

i am not able to find the api version.hence i am pasting the client api so that you can find the version.
i am using chrome browser for testing.
i am pasting the client api:
/*
SmartFoxServer 2X HTML5/JavaScript API
(c) gotoAndPlay | All rights reserved
http://www.smartfoxserver.com
*/
SFS2X={SmartFox:function(a){this._majVersion=1;this._minVersion=7;this._subVersion=1;
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: SFS2X.LoginRequest is not a constructor.

Postby Bax » 12 Nov 2018, 13:47

Sorry, we had to edit your message because pasting the entire API code wasn't helpful.
In any case you are using version 1.7.1, which 1 year and a half old.
We strongly recommend that you download the latest version (1.7.12) and test again.
Paolo Bax
The SmartFoxServer Team
parichaygauss
Posts: 4
Joined: 02 Nov 2018, 11:15

Re: SFS2X.LoginRequest is not a constructor.

Postby parichaygauss » 13 Nov 2018, 04:37

after using the latest api now i am having problem in connection.
my code snippet for connection:
var sfs=null;
function init()
{
console.log("start");
var config = {};
config.host = "127.0.0.1"
config.port = 9933
config.useSSL = false;
config.zone = "BasicExamples";
config.debug = false;
sfs = new SFS2X.SmartFox();
sfs.connect();
console.log("connected");
}
error message that is displayed on console:- Invalid connection host/address

note- i have tried using port 8090,8080 also but all the mentioned ports are showing the same error.
parichaygauss
Posts: 4
Joined: 02 Nov 2018, 11:15

Re: SFS2X.LoginRequest is not a constructor.

Postby parichaygauss » 13 Nov 2018, 05:27

problem solved,by using local host in config.host i am able to login into zone.
but i have another question,
where can we find the user logged in log on server side logs ??
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2X.LoginRequest is not a constructor.

Postby Lapo » 13 Nov 2018, 08:08

parichaygauss wrote:problem solved,by using local host in config.host i am able to login into zone.
but i have another question,
where can we find the user logged in log on server side logs ??

In the server side logs :)
Under SFS2X/logs/smartfox.log
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 16 guests