hasura / hasura/graphql-engine
Hasura doesn't conform to graphql-ws nor the subscriptions-transport-ws spec correctly - Receiving ping/keepalive message before connection_ack
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.15.0
### Environment
OSS
### What is the current behaviour?
Similar to #7002, when using the new [protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) we receive a Ping message before a connection_ack. This causes libraries like dgs and Apollo Kotlin to throw and log errors.
```
unknown graphql-ws message while waiting for connection_ack: 'ping
```
```
reactor.core.Exceptions$ErrorCallbackNotImplemented: graphql.GraphQLException: Acknowledgement expected from server, received OperationMessage(type=ka, payload=null, id=)
Caused by: graphql.GraphQLException: Acknowledgement expected from server, received OperationMessage(type=ka, payload=null, id=)
at com.netflix.graphql.dgs.client.WebSocketGraphQLClient$doHandshake$1$1.invoke(WebSocketGraphQLClient.kt:138)
at com.netflix.graphql.dgs.client.WebSocketGraphQLClient$doHandshake$1$1.invoke(WebSocketGraphQLClient.kt:134)
at com.netflix.graphql.dgs.client.WebSocketGraphQLClient.doHandshake$lambda$7$lambda$6(WebSocketGraphQLClient.kt:134)
```
### What is the expected behaviour?
Keep alives/pings should not be sent until the connection has been acked.
### How to reproduce the issue?
Connect to any Hasura Subscription using the dgs library or Apollo Kotlin library for example.
### Any possible solutions/workarounds you're aware of?
No
Contributor guide
Research direction
Start by reproducing the subscription handshake with the DGS or Apollo Kotlin client, using the WebSocketGraphQLClient.kt stack trace as the client-side reference. Inspect the server's WebSocket connection handling and keepalive behavior, then add or run tests covering the handshake. Done means no ping, keepalive, or ka message is sent before connection_ack.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100