Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Resolved Client Cannot Use WSS to connect server

Discussion in 'Dedicated Server' started by tuzun, Aug 12, 2023.

  1. tuzun

    tuzun

    Joined:
    Apr 19, 2023
    Posts:
    3
    Anyone knows how can I solve this issue, my ip is certified, using nginx reverse proxy and also I am using cert.pfx and cerf.json for Simple Web Transport script from Mirror. Still I cannot connect with Wss, what can be the problem?


    [SimpleWebTransport] ERROR: [SimpleWebTransport] Create SSLStream Failed: System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
    at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x00115] in <c01a3e84b3c1471e86b1e3fb11d4015b>:0
    at Mono.Net.Security.AsyncProtocolRequest.StartOperation (System.Threading.CancellationToken cancellationToken) [0x0008b] in <c01a3e84b3c1471e86b1e3fb11d4015b>:0
    at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0004b] in <c01a3e84b3c1471e86b1e3fb11d4015b>:0
    at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient(string,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Security.Authentication.SslProtocols,bool)
    at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00006] in <c01a3e84b3c1471e86b1e3fb11d4015b>:0
    at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost) [0x00007] in <c01a3e84b3c1471e86b1e3fb11d4015b>:0
    at Mirror.SimpleWeb.ClientSslHelper.CreateStream (System.Net.Sockets.NetworkStream stream, System.Uri uri) [0x00013] in E:\Gokhan 2\Unity Projects\Dead End Main Project\Assets\Mirror\Transports\SimpleWeb\SimpleWeb\Client\StandAlone\ClientSslHelper.cs:35
    at Mirror.SimpleWeb.ClientSslHelper.TryCreateStream (Mirror.SimpleWeb.Connection conn, System.Uri uri) [0x00028] in E:\Gokhan 2\Unity Projects\Dead End Main Project\Assets\Mirror\Transports\SimpleWeb\SimpleWeb\Client\StandAlone\ClientSslHelper.cs:22
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    Mirror.SimpleWeb.Log:Error (string,bool) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Common/Log.cs:111)
    Mirror.SimpleWeb.ClientSslHelper:TryCreateStream (Mirror.SimpleWeb.Connection,System.Uri) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/ClientSslHelper.cs:27)
    Mirror.SimpleWeb.WebSocketClientStandAlone:ConnectAndReceiveLoop (System.Uri) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/WebSocketClientStandAlone.cs:60)
    Mirror.SimpleWeb.WebSocketClientStandAlone/<>c__DisplayClass5_0:<Connect>b__0 () (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/WebSocketClientStandAlone.cs:36)
    System.Threading.ThreadHelper:ThreadStart ()
     
  2. tuzun

    tuzun

    Joined:
    Apr 19, 2023
    Posts:
    3
    I solved this issue with reverse proxy code on nginx
     
  3. tiagof

    tiagof

    Joined:
    May 16, 2018
    Posts:
    1
    I'm having this same error. I use a server with a reverse proxy configured for port 27777 as per the example on the Mirror website.
    The client is configured with port 7777 while the server is configured with port 27777. When the client is on 7777 I receive the response that the server actively refused, when it is on 27777 it returns this error:

    [SimpleWebTransport] ERROR: [SimpleWebTransport] Create SSLStream Failed: System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
    at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x00115] in <e6940d8ae2364839bd68ca06089600fc>:0
    at Mono.Net.Security.AsyncProtocolRequest.StartOperation (System.Threading.CancellationToken cancellationToken) [0x0008b] in <e6940d8ae2364839bd68ca06089600fc>:0
    at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0004b] in <e6940d8ae2364839bd68ca06089600fc>:0
    at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient(string,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Security.Authentication.SslProtocols,bool)
    at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00006] in <e6940d8ae2364839bd68ca06089600fc>:0
    at System.Net.Security.SslStream.AuthenticateAsClient (System.String targetHost) [0x00007] in <e6940d8ae2364839bd68ca06089600fc>:0
    at Mirror.SimpleWeb.ClientSslHelper.CreateStream (System.Net.Sockets.NetworkStream stream, System.Uri uri) [0x00015] in D:\Documentos\OAK\metaverso-estudologia\Assets\Mirror\Transports\SimpleWeb\SimpleWeb\Client\StandAlone\ClientSslHelper.cs:35
    at Mirror.SimpleWeb.ClientSslHelper.TryCreateStream (Mirror.SimpleWeb.Connection conn, System.Uri uri) [0x0002f] in D:\Documentos\OAK\metaverso-estudologia\Assets\Mirror\Transports\SimpleWeb\SimpleWeb\Client\StandAlone\ClientSslHelper.cs:22
    UnityEngine.Logger:Log (UnityEngine.LogType,object)
    Mirror.SimpleWeb.Log:Error (string,bool) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Common/Log.cs:95)
    Mirror.SimpleWeb.ClientSslHelper:TryCreateStream (Mirror.SimpleWeb.Connection,System.Uri) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/ClientSslHelper.cs:27)
    Mirror.SimpleWeb.WebSocketClientStandAlone:ConnectAndReceiveLoop (System.Uri) (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/WebSocketClientStandAlone.cs:60)
    Mirror.SimpleWeb.WebSocketClientStandAlone/<>c__DisplayClass5_0:<Connect>b__0 () (at Assets/Mirror/Transports/SimpleWeb/SimpleWeb/Client/StandAlone/WebSocketClientStandAlone.cs:36)
    System.Threading.ThreadHelper:ThreadStart ()

    The client configuration has the "Use WSS" box checked and the SSL protocol is TLS13.
    And the server uses nginx with the configuration done as shown here:
    https://mirror-networking.gitbook.io/docs/manual/transports/websockets-transport/reverse-proxy