简体   繁体   中英

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# TcpClient ), but UnityEngine.Network namespace isn't supported in WebGL build .

Any suggestions?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM