html5 putLong data type

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

loki
Posts: 66
Joined: 04 Apr 2010, 11:16
Location: Latvia
Contact:

html5 putLong data type

Postby loki » 04 Feb 2015, 22:59

Hello everyone,

Faced with a strange problem under Linux, in Windows everyting is fine.

Code: Select all

var data = { };
data.R = 5;
data.m = 5000;
new SFS2X.Requests.System.ExtensionRequest("reloadM", data);


When I send data from html5 app to java server, server can't read the variables, because server waits vars in long format (params.getLong("m")), but accourding to params.getDump() html5 sends (int) variable (number is not huge 5000, but it could be very huge, depends on user).
I can't change it to int, because this server holds connections from flash, mobile apps (ios, android) and other appliations send variables in currect format. Is there a way to send number variable from html5 in long format?

Ofcourse I may use something like this, but in this way I will need to change a lot.

Code: Select all

SFSDataWrapper data = params.get("m");
long moneyTake;
if(data.getTypeId()==SFSDataType.INT) {
   moneyTake = params.getInt("m");
}else{
   moneyTake = params.getLong("m");
}


Thanks!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: html5 putLong data type

Postby Lapo » 05 Feb 2015, 17:46

Hi,
I am not clear about the Windows vs Linux thing.

Do you mean that the same client behaves differently when connected to Win-based SFS vs a Linux-based SFS?
Or it's client issue? Same server, but clients based on Windows and Linux behave differently?

thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
loki
Posts: 66
Joined: 04 Apr 2010, 11:16
Location: Latvia
Contact:

Re: html5 putLong data type

Postby loki » 05 Feb 2015, 21:39

When SFS-server run under Windows, command params.getLong("m") works even if the variable "m" is int, but under Linux not (strange thing). But anyway the question is, does it possible to send variable "m" from html5 client like long variable?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: html5 putLong data type

Postby Lapo » 05 Feb 2015, 21:58

Yes, it is possible.
Are you sure you're running exactly the same version of SmartFoxServer on both Linux and Windows?

In particular, update 2.9.2 addressed one problem with int <---> long conversion for websocket clients... I suspect that's the problem :)

Download here: http://www.smartfoxserver.com/download/sfs2x#p=updates
Lapo

--

gotoAndPlay()

...addicted to flash games
loki
Posts: 66
Joined: 04 Apr 2010, 11:16
Location: Latvia
Contact:

Re: html5 putLong data type

Postby loki » 06 Feb 2015, 23:17

Thanks Lapo,

You was right, problem was in server version. I didn't noticed that the versions are different.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 17 guests