Description
Describe the bug
I'm using the client generated by genClient with Hasura and have noticed that subscriptions are failing.
The problem is that Hasura implements keep-alive messages for the 'graphql-transport-ws' and 'graphql-ws' protocols. In the former case, it sends 'ping' messages; in the latter, 'ka' messages. Neither of these messages includes an ID, which triggers the following error: https://github.com/cheina97/genqlient/blob/6309a6ef5f325d254be1a91756b56fd9ec5441a3/graphql/websocket.go#L143-L145.
I have two possible solutions (I tested both and they work):
- Exclude messages with "ka" or "ping" type.
- Return nil instead of this error: https://github.com/cheina97/genqlient/blob/6309a6ef5f325d254be1a91756b56fd9ec5441a3/graphql/websocket.go#L143-L145.
I've noticed that the ID parameter is an optional field in both graphql-ws and graphql-transport-ws. Therefore, this solution should also solve the same error for other message types.
Do you have any other suggestions? I can open a PR and implement it.
I'm also aware that genqlient should implement a response to these messages. Do you think it would be feasible to implement this in the next PR?
To Reproduce
Deploy Hasura and try genqlient with it.
Expected behavior
Subscriptions should work with hasura graphql server.
genqlient version
v0.8.1