WatsonWebsocket
WatsonWebsocket copied to clipboard
StartWithTimeoutAsync fails the second try.
Bug Report
Operating system and version: Windows 10 Framework and runtime: .NET 6.0 Nuget version 3.0.1
Issue encountered:
When I use StartWithTimeoutAsync
, after the first timeout, it fails with The WebSocket has already been started
Expected behavior:
The Client should try to start the connection again. The same code works as expected in .Net Framework 4.8
Steps to reproduce:
Call StartWithTimeoutAsync
until connected.
Sample code encapsulating the problem:
while (!Connected)
{
try
{
await StartWithTimeoutAsync(30);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Exception details:
System.InvalidOperationException: 'The WebSocket has already been started.'
StackTrace:
at System.Net.WebSockets.ClientWebSocketOptions.ThrowIfReadOnly()
at WatsonWebsocket.WatsonWsClient.SetInvalidCertificateAcceptance()
at WatsonWebsocket.WatsonWsClient.<StartWithTimeoutAsync>d__51.MoveNext()