Pipe should complete with exception if WebSockets closed prematurely
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
## Summary
Currently, if a WebSocket is closed prematurely, the application pipe will complete with no exception. As a server, we need to catch this kind of error in our higher layer codes and log it in our specific format or add some special logic.
If the pipe closes very normally, we can't tell whether it's a real normal close or unexpected close.
https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/common/Http.Connections/src/Internal/Transports/WebSocketsServerTransport.cs#L179
## Motivation and goals
Unexpected close should not swallow in such low layer. It can throw rethrow a new exception such as `ClosedPrematurelyException` to tell application layer an unexpected/network issue. As a service provider, if we can't tell the close reason easily, we lose many opportunities.
Contributor guide
Assessment
This issue has not been assessed yet.