Suvitruf Suvitruf - 1 year ago 468
C# Question

Https client for WebGL build in Unity3d

I need https client for WebGL build.

WWW is horrible. First of all, it doesn't support keep-alive connections, plus it has problems with https.

UnityWebRequest doesn't support keep-alive.

There is plugin for WebSockets by Unity team, but it was last updated year ago.

For other platforms I have wrote custom solution based on raw sockets (C#

), but
namespace isn't supported in WebGL build.

Any suggestions?

Answer Source

Looks like UnityWebRequest is fine now. In Unity 5.3 it was in experimental namespace and it literally haven't worked.

In Untiy 5.4 this class was moved to UnityEngine.Networking and seems stable. And, surprisingly, it has support for keep-alive connection. So, for WebGL build I can use it (at least with Unity >= 5.4).

Note: for WebGL build your server should set CORS headers. Also, your server should support OPTIONS requests.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download