From 422d5b92ffb196a2084e65812b723d8c515b3e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84kwav?= Date: Wed, 3 Oct 2018 01:12:58 +0200 Subject: [PATCH 1/2] Fixed wss error in unity3d The connection couldn't be established if the certificates are empty which was the case for me. --- websocket-sharp/WebSocket.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 93ed5bf4e..68d87c670 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2137,12 +2137,16 @@ private void setClientStream () false, conf.ServerCertificateValidationCallback, conf.ClientCertificateSelectionCallback); - - sslStream.AuthenticateAsClient ( - host, - conf.ClientCertificates, - conf.EnabledSslProtocols, - conf.CheckCertificateRevocation); + + // The connection couldn't be established if the certificates are empty + if (conf.ClientCertificates != null) + sslStream.AuthenticateAsClient( + host, + conf.ClientCertificates, + conf.EnabledSslProtocols, + conf.CheckCertificateRevocation); + else + sslStream.AuthenticateAsClient(host); _stream = sslStream; } From 784adf60b0f5732d1918268f8af047ab89de2dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84kwav?= Date: Wed, 3 Oct 2018 01:20:03 +0200 Subject: [PATCH 2/2] Fixed formating --- websocket-sharp/WebSocket.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 68d87c670..a5e3af3d0 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2140,13 +2140,13 @@ private void setClientStream () // The connection couldn't be established if the certificates are empty if (conf.ClientCertificates != null) - sslStream.AuthenticateAsClient( - host, - conf.ClientCertificates, - conf.EnabledSslProtocols, - conf.CheckCertificateRevocation); - else - sslStream.AuthenticateAsClient(host); + sslStream.AuthenticateAsClient( + host, + conf.ClientCertificates, + conf.EnabledSslProtocols, + conf.CheckCertificateRevocation); + else + sslStream.AuthenticateAsClient(host); _stream = sslStream; }