Skip to content

GraphQL Client is not able to reconnect if graphQL server restart #180

Open
@akoliya003

Description

@akoliya003

Hi,

GraphQL Client is not able to reconnect if graphQL server restart.
In my local copy below is the change I have added.

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.<CreateSubscriptionStream>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.<SendFrameFallbackAsync>d__56.MoveNext()
   at System.Net.WebSockets.ManagedWebSocket.<SendFrameFallbackAsync>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.<<CreateSubscriptionStream>b__5>d.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions