[BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

nghuuhieu1994
Posts: 4
Joined: 06 Dec 2016, 09:06

[BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby nghuuhieu1994 » 06 Dec 2016, 09:13

Our server side use Smartfox version 2.12.0 and send float to client by PutFloat function but when we receive data and log type, it always INT for number like 10.0f, 20.0f, 35.0f, 42.0f... and double for number like 42.2f, 45.5f, 50.2f... Please check this bug ASAP.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby Lapo » 06 Dec 2016, 09:17

Please check this post:
viewtopic.php?f=20&t=18904

Download the jar from the provided link and report back if it solves your problem.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
nghuuhieu1994
Posts: 4
Joined: 06 Dec 2016, 09:06

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby nghuuhieu1994 » 06 Dec 2016, 09:24

Now it's double but we use GetFloat on client side and it's still crashed.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby Lapo » 06 Dec 2016, 09:49

Can you be more specific and give us an exact example of what the problem is?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
nghuuhieu1994
Posts: 4
Joined: 06 Dec 2016, 09:06

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby nghuuhieu1994 » 06 Dec 2016, 10:10

On server side, we use

Code: Select all

data = new SFSObject();
data.putFloat("score", friendScore);

then send it's to client.
Our client side use

Code: Select all

ISFSObject data = getDataFromServer();
data.getFloat("score");

and our WebGL client crashed when receive that packet.
We try to log type of "score" variable by Type property of SFSDataWrapper

Code: Select all

data.GetData("score").Type

and it's show type is 7 means DOUBLE in SFSDataType enum.
So that, our client get "InvalidCastException: Cannot cast from source type to destination type" and crash.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby Bax » 06 Dec 2016, 13:33

We can't reproduce the issue.
We executed the following tests:

1)
After joining a room, we send a public message to the server containing a object with the Float value 42.2f.
When the message is received back, we can read that value using the GetFloat method.
This works both in the Editor and in the browser.

2)
We send an extension message to the server containing a object with the Float value 42.2f.
The extension creates a new SFSObject (so not reusing the one it just received) setting a Float value to 3.7f and sends a response to the client. When the extension response is received by the client, we can read that value using the GetFloat method.
Again, this works both in the Editor and in the browser.

In both cases the type of the value is System.Single (at least in the Editor, I didn't check what is reported in the browser)

Can you make the same simple tests?
Paolo Bax
The SmartFoxServer Team
nghuuhieu1994
Posts: 4
Joined: 06 Dec 2016, 09:06

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby nghuuhieu1994 » 06 Dec 2016, 16:36

Thank for your quickly support. The problem is solved now.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [BUGS][UNITY][WEBGL][CLIENT_API_1.7.1][MISMATCH DATA TYPE FROM SERVER]

Postby Bax » 06 Dec 2016, 16:42

Can you please describe what the solution was? For future reference.
Thanks.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 26 guests