Open netvillage opened 4 years ago
well. I think this might be an issue with 4.2.9. because if I change the nuGet package to 4.2.4 and below it seems to be working.
@deniszykov, +1 I also ran into this problem (v4.2.10). and also the rollback to version 4.2.4 helped to solve the disconnection from the server
Hi everyone. This one is fixed in 4.2.14
Also don't forget to call webSocket.CloseAsync()
after you are done with WebSocket and want to dispose it. I see in your example you close socket only on errors. Current examples from repository contains valid close routine.
Hi everyone. This one is fixed in 4.2.14
Also don't forget to call
webSocket.CloseAsync()
after you are done with WebSocket and want to dispose it. I see in your example you close socket only on errors. Current examples from repository contains valid close routine.
Super! Updated to 4.2.14 and everything worked, thank you. Just yesterday, nuget did not have this version.
I think the issue can be closed.
If I do a javascript ws.close(); from the client, the server never seems to see it. The earlier version of vtortola 2.2.0.3 seems to work. A .close() on the client, it will trigger a msg = null after the line String msg = await ws.ReadStringAsync(cancellation).ConfigureAwait(false); and set the ws.IsConnected to false, taking it to the finally in the try/catch. The 4.2.9 version just sits there. I used the simple echoserver code example and it does the same thing. here's my client side code (which I used to test both old and new):
` var noSupportMessage = "Your browser cannot support WebSocket!"; var ws;
`
and my C# code here
` public partial class MainWindow : Window { public IPEndPoint endpoint; // The IP/Port websocket service is listening on public WebSocketListener server; CancellationTokenSource cancellation;
`
As I mentioned, it's pretty much the echo code, and the older version seems to work