Can't connect to server with WebGL build in Unity

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

Moderators: Lapo, Bax

Rainydaze
Posts: 3
Joined: 15 Oct 2018, 18:05

Can't connect to server with WebGL build in Unity

Postby Rainydaze » 08 Aug 2019, 16:25

I'm rebuilding a flash app that has been working fine for a few years and moving it to Unity. I'm on the latest version of Unity 2019.3, SFS server 2.13.6. My problem is that I can connect my app with the Unity editor and the pc build but the WebGL build never connects. The admin tool logs never show any activity either when I try to connect. It will work fine using the stand alone pc build exe only.
I'd appreciate some thoughts on what I might look at to try to solve this issue.
User avatar
Lapo
Site Admin
Posts: 21012
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Can't connect to server with WebGL build in Unity

Postby Lapo » 09 Aug 2019, 07:47

Hi,
are you checking the error logs in the browser's console? Chances are there the cause of the problem is found there.
For example it could be a crossdomain issue, if you're testing from the local file system.

Let us know
Lapo
--
gotoAndPlay()
...addicted to flash games
Rainydaze
Posts: 3
Joined: 15 Oct 2018, 18:05

Re: Can't connect to server with WebGL build in Unity

Postby Rainydaze » 14 Aug 2019, 00:53

I haven't been able to find any errors in my browser window that would help. The browser console shows no errors. The admin tool shows no activity. I thought I would experiment and used the Connector example from the asset store. I changed the hostport to my SFS server ip address and ran it in the Unity editor and it connected fine. When I built it as a WebGL platform it wouldn't connect. The only error message I find says " 'ws: <ip address> /websocket' failed: Connection closed before receiving a handshake response." The admin tool however does show activity in that it says a session is created but the onConnection event never fires and then the panel shows an SFS Error WebSocketLayer connection error.
Any advice would be appreciated.
User avatar
Bax
Site Admin
Posts: 4478
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Can't connect to server with WebGL build in Unity

Postby Bax » 14 Aug 2019, 07:11

Could you please make sure that websocket is properly configured in your server? Go to the AdminTool's Server Configurator module, Web server tab and check if it is configured like this:

Image

If yes, I would like to try to connect to your server myself. Can you please share (privately by email) your server address? You can write to support AT smartfoxserver DOT com.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 5 guests