Page 1 of 1

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

Posted: 06 Dec 2016, 09:13
by nghuuhieu1994
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.

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

Posted: 06 Dec 2016, 09:17
by Lapo
Please check this post:
http://forums.smartfoxserver.com/viewto ... 20&t=18904

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

Thanks

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

Posted: 06 Dec 2016, 09:24
by nghuuhieu1994
Now it's double but we use GetFloat on client side and it's still crashed.

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

Posted: 06 Dec 2016, 09:49
by Lapo
Can you be more specific and give us an exact example of what the problem is?

Thanks

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

Posted: 06 Dec 2016, 10:10
by nghuuhieu1994
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.

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

Posted: 06 Dec 2016, 13:33
by Bax
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?

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

Posted: 06 Dec 2016, 16:36
by nghuuhieu1994
Thank for your quickly support. The problem is solved now.

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

Posted: 06 Dec 2016, 16:42
by Bax
Can you please describe what the solution was? For future reference.
Thanks.