Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity SocketIOClient cannot connect SSL Server on Android #383

Open
ZFHung opened this issue Aug 5, 2024 · 3 comments
Open

Unity SocketIOClient cannot connect SSL Server on Android #383

ZFHung opened this issue Aug 5, 2024 · 3 comments

Comments

@ZFHung
Copy link

ZFHung commented Aug 5, 2024

       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;
       };
@doghappy
Copy link
Owner

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

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

@ZFHung
Copy link
Author

ZFHung commented Aug 18, 2024

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;
}
});

@doghappy
Copy link
Owner

doghappy commented Sep 1, 2024

Sorry. I'm too late.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants