Benedicht / BestHTTP-Issues

Issue tracking repo for the Best HTTP and all related Unity plugins.
https://assetstore.unity.com/publishers/4137
11 stars 1 forks source link

WebGL WebSocket error #156

Closed cosminsclipcea closed 1 year ago

cosminsclipcea commented 1 year ago

Hello,

i'm receiving this error when i try to connect to a WebSocket server using wss. The server is running inside Unity using Websocket-sharp.

WS error Request Finished with Error! Exception: protocol_version(70) at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsClientProtocol.ProcessServerHello (BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.ServerHello serverHello) [0x000af] in D:\UnityProjects\STUGI WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsClientProtocol.cs:1094 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsClientProtocol.HandleHandshakeMessage (System.Int16 type, BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.HandshakeMessageInput buf) [0x00305] in D:\UnityProjects\STUGI WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsClientProtocol.cs:468 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsProtocol.ProcessHandshakeQueue (BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.ByteQueue queue) [0x0019e] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsProtocol.cs:644 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsProtocol.ProcessRecord (System.Int16 protocol, System.Byte[] buf, System.Int32 off, System.Int32 len) [0x000c5] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsProtocol.cs:523 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.RecordStream.ReadRecord () [0x000cd] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\RecordStream.cs:233 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsProtocol.SafeReadRecord () [0x00069] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsProtocol.cs:882 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsProtocol.BlockForHandshake () [0x00024] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsProtocol.cs:354 at BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsClientProtocol.Connect (BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.TlsClient tlsClient) [0x0006c] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\SecureProtocol\tls\TlsClientProtocol.cs:79 at BestHTTP.Connections.TCPConnector.Connect (BestHTTP.HTTPRequest request) [0x006fe] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\Connections\TCPConnector.cs:252 at BestHTTP.Connections.HTTPConnection.ThreadFunc () [0x0009d] in D:\UnityProjects\APP WEB\Assets\Best HTTP\Source\Connections\HTTPConnection.cs:140 UnityEngine.MonoBehaviour:print (object) SendImageToTable:OnError (BestHTTP.WebSocket.WebSocket,string) (at Assets/Scripts/SendImageToTable.cs:50) BestHTTP.WebSocket.OverHTTP1:OnInternalRequestCallback (BestHTTP.HTTPRequest,BestHTTP.HTTPResponse) (at Assets/Best HTTP/Source/WebSocket/Implementations/OverHTTP1.cs:194) BestHTTP.Core.RequestEventHelper:HandleRequestStateChange (BestHTTP.Core.RequestEventInfo) (at Assets/Best HTTP/Source/Core/RequestEvents.cs:569) BestHTTP.Core.RequestEventHelper:ProcessQueue () (at Assets/Best HTTP/Source/Core/RequestEvents.cs:437) BestHTTP.HTTPManager:OnUpdate () (at Assets/Best HTTP/Source/HTTPManager.cs:422) BestHTTP.HTTPUpdateDelegator:CallOnUpdate () (at Assets/Best HTTP/Source/HTTPUpdateDelegator.cs:278) BestHTTP.HTTPUpdateDelegator:Update () (at Assets/Best HTTP/Source/HTTPUpdateDelegator.cs:268)

Benedicht commented 1 year ago

This means that the server is trying to use an old TLS version that the client doesn't support now. The plugin supports TLS v1.2 and v1.3. TLS v1.2 is available since 2008, no older version of TLS should be used.

cosminsclipcea commented 1 year ago

Thank you! That was the problem.