socket.io-client-csharp icon indicating copy to clipboard operation
socket.io-client-csharp copied to clipboard

How use proxy in version 3.0.6?

Open thiagomoises opened this issue 2 years ago • 1 comments

I did upgrade for 3.0.6 version and i have a problem. Until verson 3.0.5, existed a class DefaultClientWebSocket. I used it for change ConfigOptions and set Proxy and certificateValidationCallback.

            SocketIOClient.ClientWebSocketProvider = () =>
            {
                var clientWebSocket = new DefaultClientWebSocket()
                {
                    ConfigOptions = o =>
                    {
                        if (o != null)
                        {
                            var options = o as ClientWebSocketOptions;

                            options!.Proxy = _proxy;
                            options.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
                            {
                                return true;
                            };
                        }
                    }
                };
                return clientWebSocket;
            };

How use it in 3.0.6 version?

thiagomoises avatar May 23 '22 00:05 thiagomoises

Any update about this?

thiagomoises avatar Jul 12 '22 19:07 thiagomoises

sorry the doc is out of date, for newer version:

io.ClientWebSocketProvider = () =>
{
    var client = new DefaultClientWebSocket();
    client.SetProxy(...);
    client.AddHeader(...);
    return client;
};

doghappy avatar Feb 19 '23 08:02 doghappy

For ignoring ssl, is ConfigOptions still relevant? Because when i use it, visual studio throw an error "DefaultClientWebSocket does not contain a definition for ConfigOptions". Btw thank u for maintaning this library

triplef07 avatar Feb 20 '23 08:02 triplef07