Did anyone manage to use the NativeWebSocket/ClientWebSocket through a proxy?
Basically I tried to set the Proxy property from the ClientWebSocketOptions but the client does't connect to the server. It's giving me a 'Unable to connect to the remote server' error.
Here's my code snippet:
var source = new CancellationTokenSource();
var token = source.Token;
var socket = new ClientWebSocket();
WebRequest.DefaultWebProxy = new WebProxy(proxyUrl, false); // I tried to set the DefaultWebProxy too, but I get the same error
socket.Options.Proxy = new WebProxy(proxyUrl, false);
await socket.ConnectAsync(uri, token);
It works in .NET5 but not in Unity.
Any insights or suggestions on resolving this issue would be greatly appreciated.
Did anyone manage to use the
NativeWebSocket
/ClientWebSocket
through a proxy?Basically I tried to set the
Proxy
property from theClientWebSocketOptions
but the client does't connect to the server. It's giving me a 'Unable to connect to the remote server' error.Here's my code snippet:
It works in .NET5 but not in Unity.
Any insights or suggestions on resolving this issue would be greatly appreciated.