I am trying to create an online multiplayer game, but UnityEngine.Networking isn't supported with WebGL exports. What would be the best way to create a networked game for WebGL?

I have a game that I posted on my website as a WebGL export. But the problem is that its a networked game, where all the scripts use the class UnityEngine.Networking. After I posted the game I found out that WebGL can’t create servers… No Problem, so I created a server, after that I couldn’t join my server. After some research I found out that WebGL dose not support UnityEngine.Networking. What would be the best approach to creating this game where it would work with a WebGL export (Preferably where WebGL User can also host the server).

UnityEngine.Networking does work with WebGL, only you need to activate it on the NetworkManager (WebSockets). And note, that you cannot connect with any other client platform than WebGL if you do activate it.

Hosting a server is impossible though with WebGL, you have to make the server dedicated.

EDIT: Just corrected the last sentence where it said “Hosting a server is impossible with WebSockets enabled”. That can be confusing as it is possible to have WebSockets enabled and hosting a server surely, but not WHILE you’re running a WebGL build in a web browser.