There are plenty of good Websocket APIs for C#, but I run into trouble when targeting Unity WebGL due to this restriction described in the Unity documentation:
No direct socket access
System.Net.Sockets) are non-functional in WebGL. The same applies to Unity’s old
UnityEngine.Network*classes, which are not available when building for WebGL.
If you need to use Networking in WebGL, you currently have the options to use the
How can I work around this restriction for networking in my Unity WebGL game?