doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
721 stars 124 forks source link

How use proxy in version 3.0.6? #282

Closed thiagomoises closed 1 year ago

thiagomoises commented 2 years ago

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 commented 2 years ago

Any update about this?

doghappy commented 1 year ago

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

io.ClientWebSocketProvider = () =>
{
    var client = new DefaultClientWebSocket();
    client.SetProxy(...);
    client.AddHeader(...);
    return client;
};
triplef07 commented 1 year ago

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