Porting from Desktop / UWP to WebGL comes with a lot of challenges. When I ported an application, there were many libraries and code which didn't work on WebGL. However, I found alternatives and were able to switch libraries to make it work in WebGL.
- System.Net namespace
- Threads are not supported (System.Threading)
- No Multithreading
- No direct access to socket
- Reflection using System.Reflection.Emit
- WebGL graphics limitations
- Websocket: System.Net.WebSockets
- GLTF: UnityGLTF
- JSON: Newtonsoft.Json
- HTTP Request: CI.HttpClient
For websockets, I switched to https://github.com/endel/NativeWebSocket
For gltf support, I switched to https://github.com/atteneder/glTFast
For json support, I switched to https://github.com/jilleJr/Newtonsoft.Json-for-Unity
If your code doesn't depend much on Newtonsoft.JSON, an alternative is to use Unity's builtin json support
For http requests, I switched to Unity's builtin UnityWebRequest