graphql-dotnet / graphql-dotnet/graphql-client
GraphQL Client is not able to reconnect if graphQL server restart
- Dominant language
- C#
- Stars
- 648
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
GraphQL Client is not able to reconnect if graphQL server restart.
In my local copy below is the change I have added.
```csharp
GraphQL.Client --> Http --> GraphQLHttpWebSocket.cs --> _receiveResultAsync(...) -->
.....
catch (Exception e)
{
**await _closeAsync().ConfigureAwait(false);
clientWebSocket?.Dispose();**
Debug.WriteLine($"exception thrown while receiving websocket data: {e}");
throw;
}
```
You may also have some better way.
```
-----------------------------------------------------------------------------------------------
WebSocketException: The remote party closed the WebSocket connection without completing the close handshake. (WebSocketError ConnectionClosedPrematurely, ErrorCode 0, NativeErrorCode 0
WebSocketException: The remote party closed the WebSocket connection without completing the close handshake. (WebSocketError ConnectionClosedPrematurely, ErrorCode 0, NativeErrorCode 0
System.NullReferenceException: Object reference not set to an instance of an object.
at GraphQL.Client.Http.Websocket.GraphQLHttpWebsocketHelpers.<>c__DisplayClass0_0`1.b__3(Exception e)
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. ---> System.IO.IOException: Unable to transfer data on the transport connection: Broken pipe. ---> System.Net.Sockets.SocketException: Broken pipe
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.WebSockets.ManagedWebSocket.d__56.MoveNext()
at System.Net.WebSockets.ManagedWebSocket.d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket.<_sendWebSocketRequest>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at GraphQL.Client.Http.Websocket.GraphQLHttpWebsocketHelpers.<>c__DisplayClass0_0`1.<b__5>d.MoveNext()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.