Closed
Description
Description
In a C# Blazor WebAssembly (WASM) application where multiple threads aren't utilized, there's an issue with the ClientWebSocket's ReceiveAsync method. Initially, data is received successfully. However, due to extended processing time for preceding data, the server disconnects before subsequent data can be retrieved using ReceiveAsync. Strangely, at the JavaScript layer, it's evident that the subsequent data has arrived (confirmed via WebSocket data in browser network captures). How can this scenario be effectively addressed?
Reproduction Steps
- Establish a ClientWebSocket connection in a C# Blazor WebAssembly application.
- Begin receiving data using the ReceiveAsync method.
- Process the initially received data that might take an extended period.
- While processing, allow enough time for additional data to arrive from the server.
- Observe that due to the prolonged processing time, the server disconnects before the processing completes.
- Monitor the WebSocket traffic using browser network tools to confirm the arrival of subsequent data.
demo git
Expected behavior
- The ClientWebSocket's ReceiveAsync method should continuously receive and buffer incoming data, irrespective of the time taken for processing previously received data.
- Even if there's a delay in handling the initial data, subsequent data should be accessible via ReceiveAsync, allowing uninterrupted data reception.
Actual behavior
- Initial data is received successfully through ReceiveAsync.
- However, when processing takes an extended duration, the server disconnects, and subsequent data becomes inaccessible via ReceiveAsync.
- Browser network captures indicate the arrival of subsequent data, which isn't retrievable due to the disconnection issue.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response