websocket-client icon indicating copy to clipboard operation
websocket-client copied to clipboard

TLS 1.2

Open caffreysbb opened this issue 4 years ago • 7 comments
trafficstars

Hi. How set SslConfiguration in client? Me need set System.Security.Authentication.SslProtocols.Tls12 in WEbSocket client for connect to wss.

caffreysbb avatar Aug 06 '21 09:08 caffreysbb

Hello @caffreysbb,

did you try to set it through advanced configuration?

Marfusios avatar Aug 11 '21 08:08 Marfusios

Hello @caffreysbb,

did you try to set it through advanced configuration?

I'm having issue with this right now, where in the advanced config can you specify the TLS version? I can't find anything related to TLS in the options or online.

Meigs2 avatar Jul 22 '22 18:07 Meigs2

I am stuck with this same issue. Any update on this?

gkapellmann avatar Sep 16 '22 11:09 gkapellmann

I am stuck with this same issue. Any update on this?

My issue ended up being related to how the native Clientwebsocket sets its headers, turns out it always specifies a few of them and my requests were sending bad header info.

You can specify your tls version in System.Security.Authentication, however as far as I'm aware and after looking into it a bit, it doesnt seem like there's a way to configure the protocol yourself directly on the native implementation of the ClientWebSocket. Seems like you'd need a custom websocket implementation to do it.

Meigs2 avatar Sep 16 '22 18:09 Meigs2

How can I specify this in advanced config ? cannot find that variable there.

HossamElwahsh avatar Sep 26 '22 18:09 HossamElwahsh

How can I specify this in advanced config ? cannot find that variable there.

You cannot at the moment with the standard ClientWebSocket, which this library wraps. At least as far as I know. Make sure your issue is directly related to TLS, I thought mine was however it turned out it was not.

Meigs2 avatar Sep 26 '22 18:09 Meigs2

Is there any update on this issue? I have a user who is experiencing the exception

System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
 ---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The read operation failed, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090326): The message received was unexpected or badly formatted

I experienced a similar error related to the HttpClientHandler component, but I managed to solve the issue by

 var httpClientHandler = new HttpClientHandler
       {
           SslProtocols = SslProtocols.Tls12
       };

Is it possible to achieve something similar with WebsocketClient?

sanyandreichuk avatar Mar 15 '23 10:03 sanyandreichuk