Fix the issue when the client prematurely closes and the server canno… #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…t complete the websocket reader pipeline
When a GraphQL client is subscribed and prematurely closes (e.g. the app crashes, or is simply closed), the WebSocketReaderPipeline tries to close the socket by calling _socket.CloseAsync which never returns.
Even though Microsoft's documentation on CloseAsync and CloseOutputAsync is quite similar, according to the below links:
CloseAsync waits for the client to acknowledge closing of the socket, whereas CloseOutputAsync works in fire-and-forget mode.
It looks like the use of those methods should be swapped to achieve the correct semantics, so that CloseAsync does not get stuck waiting for the client's acknowledgement (the client may already be closed by now) and hence never complete the reader pipeline.