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

Unity SocketIOClient cannot connect SSL Server on Android

Open ZFHung opened this issue 1 year ago • 3 comments

       Unity Error,how to pass SSL errors
       
       Assets\Socket_Manager.cs(107,28): error CS0029: Cannot implicitly convert type 'System.Net.WebSockets.ClientWebSocket' to 'SocketIOClient.Transport.IClientWebSocket'
       
       
       client = new SocketIOUnity("wss://xxxx", new SocketIOOptions
       {
           ReconnectionAttempts = 5,
       });
       client.ClientWebSocketProvider = () =>
       {
           var clientWebSocket = new ClientWebSocket();
           clientWebSocket.Options.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
           {
               Console.WriteLine("SslPolicyErrors: " + sslPolicyErrors); 
               return true;
           };
           return clientWebSocket;
       };

ZFHung avatar Aug 05 '24 09:08 ZFHung

The new version was released. if you want to ignore ssl validation:

var io = new SocketIO("https://localhost:11404", new SocketIOOptions
{
    RemoteCertificateValidationCallback = (_, _, _, _) =>
    {
        return true;
    }
});

doghappy avatar Aug 18 '24 10:08 doghappy

I use this code ,still cannot coonect to the Socket Server。how can i fix?

var io = new SocketIO("https://localhost:11404", new SocketIOOptions { RemoteCertificateValidationCallback = (_, _, _, _) => { return true; } });

ZFHung avatar Aug 18 '24 12:08 ZFHung

Sorry. I'm too late.

First try to update lib to latest version, if you still blocked by compiling errors. please show error messages

doghappy avatar Sep 01 '24 14:09 doghappy