Unity 5 - Space War Example - WebGL Export

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

Moderators: Lapo, Bax

Post Reply
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Unity 5 - Space War Example - WebGL Export

Post by Sbn »

I keep getting a [SFS - ERROR] [WebSocketLayer] Communication error: Abnormal disconnection.

Unity version - Unity 5.3.5p2
sfsWebsocketSettings.PNG
(59.11 KiB) Not downloaded yet
sfsSpaceWarWebGL.PNG
(156.94 KiB) Not downloaded yet
spaceWarChromeConsole.PNG
(69.6 KiB) Not downloaded yet
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity 5 - Space War Example - WebGL Export

Post by Bax »

We just re-tested with a setup very similar to yours (Unity 5.3.5f1 instead of p2) and we could not reproduce the issue. The game works as expected.
So it is not easy to spot what the problem is here.
Are you able to connect from the Unity Editor?
Did you try one of the other examples?
What if you open a terminal window and input telnet 127.0.0.1 8888? Are you able to connect?
Paolo Bax
The SmartFoxServer Team
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

It connects with no problem. The weird part is I had SpaceWar connecting a few days ago, and changed nothing. Now I'm getting abnormal disconnects.

I'll try another example, and see what happens.
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

I tried testing the BuddyMessenger example.

This time I used the Unity that I use for my current project to make sure it wasn't that version of unity.

Unity version 5.3.4f1

This time I tested using the web player build in unity. It connected with no problem, so then I continued with a webgl test in unity.

I got the following message:

"Communication error: An exception has occurred while receiving a message. at WebSocketSharp.WebSocketFrame+<ReadAsync>c__AnonStorey1A.<>m__2E (System.Byte[] header) [0x00000] in <filename unknown>:0 \r\n at WebSocketSharp.Ext+<ReadBytesAsync>c__AnonStoreyD.<>m__1D (IAsyncResult ar) [0x00000] in <filename unknown>:0 ==> SocketError"
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity 5 - Space War Example - WebGL Export

Post by Bax »

It gets better... :shock:
Jokes apart, can you make sure you are using the latest version of SmartFoxServer and the C# API?
Paolo Bax
The SmartFoxServer Team
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

I put in

Code: Select all

Debug.LogError( (String)evt.Params["errorMessage"] );
in

Code: Select all

 private void OnConnection(BaseEvent evt) {
		if ((bool)evt.Params["success"]) {
			// Login
			sfs.Send(new Sfs2X.Requests.LoginRequest(nameInput.text));
		} else {
            Debug.LogError( (String)evt.Params["errorMessage"] );
            // Remove SFS2X listeners and re-enable interface
            reset();

			// Show error message
			errorText.text = "Connection failed; is the server running at all?";
		}
	}
	
to see if anything would be different when I exported a WebGL build and ran it.

I only got this:

Communication error: Abnormal disconnection. ==> SocketError
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

Bax wrote:It gets better... :shock:
Jokes apart, can you make sure you are using the latest version of SmartFoxServer and the C# API?
I'm on Smartfox 2.11.0, so no I'm not on latest. The example api is not the latest but the one I'm using in my project is latest. I'll try to update everything and try again with the example.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity 5 - Space War Example - WebGL Export

Post by Bax »

Updating to the latest SFS is not strictly necessary, while updating the API is highly recommended. Make sure you include the jslib file that comes with the SmartFox DLL.
Also I'd suggest to first test with the Connector example before anything else.
Paolo Bax
The SmartFoxServer Team
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

Yea, after updating everything I still get the following:

Communication error: An exception has occurred while receiving a message. at WebSocketSharp.WebSocketFrame+<ReadAsync>c__AnonStorey1A.<>m__2E (System.Byte[] header) [0x00000] in <filename unknown>:0
at WebSocketSharp.Ext+<ReadBytesAsync>c__AnonStoreyD.<>m__1D (IAsyncResult ar) [0x00000] in <filename unknown>:0 ==> SocketError
UnityEngine.Debug:LogError(Object)
BuddyMessenger:OnConnection(BaseEvent) (at Assets/BuddyMessengerAssets/Scripts/BuddyMessenger.cs:328)

I'll switch to the connector example.
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

Same on the Connector project...

fun x_X

The only thing I can think of trying now is a clean install of the server.
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

Installed a clean server and enabled Websockets, and still the same error.

Hmmm... time for some coffee and a thinking session X_X.
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

.......................................................................................


............................
............
.......


I knew that Kaspersky update was fishy...

sigh. everything working again.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity 5 - Space War Example - WebGL Export

Post by Bax »

:D :D :D
Glad you found the issue!
(and also glad it's not our fault :wink: )
Paolo Bax
The SmartFoxServer Team
Sbn
Posts: 26
Joined: 25 Nov 2014, 20:37

Re: Unity 5 - Space War Example - WebGL Export

Post by Sbn »

I try to scare you guys every once in a while ;).

Thanks for taking a look though.
Post Reply