Closed renatosc closed 3 years ago
I fixed replacing
Await messageWriterStream.WriteAsync(myData, 0, Int(myData.Length), cancellation)
with
Await messageWriterStream.WriteAndCloseAsync(myData, 0, Int(myData.Length), cancellation)
Yep, writing messages requires some form of Close
call.
It could be messageWriterStream.CloseAsync()
or messageWriterStream.WriteAndCloseAsync
. This is shown in examples.
I recommend providing WebSocketListenerOptions.Logger
during configuration of WSL. So it will be less difficult to diagnose such problems.
I am porting my code from vtortola to deniszykov. My code works fine with vtortola (brower connects to WS, send request and get a streams of image frames) but when trying the same code after migrating the code my server only sends 1 frame since the webSocket.IsConnected becomes false and thus exit the loop where I handle the message (equivalent to the EchoAllIncomingMessagesAsync() method in the EchoServer sample).
Does this fork have any timeout of something like that that would explain why it gets disconnected after I do my messageWriterStream.WriteAsync ?
UPDATE: the websocket becomes disconnected after leaving the using block as shown below: