HTML5 custom login problem

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

User avatar
tiendao
Posts: 7
Joined: 18 Mar 2017, 06:28

HTML5 custom login problem

Postby tiendao » 29 Jun 2017, 17:51

Hi all,

i using smartfox server and html5 client to connect. today i update smartfox server up to 2.13 and client 1.7.5
but i have problem on custom login

Code: Select all

var data = {};
data.param1 = this.param1;
data.param2 = this.param2;
this.sFoxClient.send(new SFS2X.LoginRequest(username, password, data, gameZone));


the question is born that: how can i put Login_In_Data to LoginRequest on html5 version 1.7.5

hope soon to receive your response,
thanks alot.
User avatar
Lapo
Site Admin
Posts: 20277
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: HTML5 custom login problem

Postby Lapo » 29 Jun 2017, 19:11

Hi,
you have referenced Javascript API 1.7.5, so we're talking about the latest version w/ binary protocol.

First of all you need to use an SFSObject to populate the parameter object.
Something like this:

Code: Select all

var gameZone = "GameZone"

var params = new SFS2X.SFSObject()
params.putInt("number", 100)
params.putUtfString("str", "Hello world")

sfs.send(new SFS2X.LoginRequest("UserName", "", params, gameZone));


For more details on LoginRequest and SFSObject take a look at the docs here:
http://docs2x.smartfoxserver.com/api-do ... index.html

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
tiendao
Posts: 7
Joined: 18 Mar 2017, 06:28

Re: HTML5 custom login problem

Postby tiendao » 30 Jun 2017, 01:12

Thanks alot Lapo!, it worked well.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 4 guests