graphql-dotnet / graphql-client

A GraphQL Client for .NET Standard
MIT License
625 stars 134 forks source link

WebSocket handler in GRAPHQL_TRANSPORT_WS protocol should not send GQL_COMPLETE when closing connection #651

Open pziezio opened 4 months ago

pziezio commented 4 months ago

Web socket handler for recently implemented graphql-transport-ws protocol sends invalid message type when closing connection:

https://github.com/graphql-dotnet/graphql-client/blob/master/src/GraphQL.Client/Websocket/GraphQLTransportWSProtocolHandler.cs#L269

which results in message:

{"type": "complete"}

According to graphql-transport-ws messages with type complete should contain an id of a subscription.

I'm using this library with a server written in different language and for every such message I'm getting a response "Missing map member: 'id'" - which I believe is justified.

IMO when closing graphql-transport-ws connection only active subscriptions should be closed but no additional messages should be sent.

hubaozhang2000 commented 2 months ago

@pziezio @rose-a There are several issues for the same problem:

https://github.com/graphql-dotnet/graphql-client/issues/620

https://github.com/graphql-dotnet/graphql-client/issues/599

The problem was introduced from 5.1.1 to 6.0.0 change.