kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
Apache License 2.0
764 stars 273 forks source link

Cannot Open Connection to wss://echo.wss-websocket.net, getting error "Authentication failed because the remote party has closed the transport stream." #171

Open ronaldowww opened 4 years ago

ronaldowww commented 4 years ago

Hi, I am using WebSocket4Net 0.15.2.11, and trying to open a connection to wss://echo.wss-websocket.net. But I got the error "Authentication failed because the remote party has closed the transport stream.".

I have already enable the SSL:

WebSocket socket = new WebSocket("wss://echo.wss-websocket.net", string.Empty, version: WebSocketVersion.Rfc6455, customHeaderItems: null); socket.Security.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls12; socket.Open(); while (socket.State == WebSocketState.Connecting) Thread.Sleep(500);

at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult) at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)

But chrome extension can work, such as Browser WebSocket Client(chrome-extension://mdmlhchldhfnfnkfmljgeinlffmdgkjo/index.html). So could you please suggest how to make it work? Thanks a lot.

BR, wen-wen