Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving keep alive message before connection_ack when subscribing #7002

Open
erikf-iccms opened this issue Jun 1, 2021 · 1 comment
Open

Comments

@erikf-iccms
Copy link

When I subscribe using websockets to Hasura Cloud it seems that I receive a keep alive message (GQL_CONNECTION_KEEP_ALIVE) before I have even sent the connection_init message (GQL_CONNECTION_INIT) to the server.

See image below:
bild
This will cause a problem for some Graph QL clients that expects a connection_ack (GQL_CONNECTION_ACK) as first message.

According to this document https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md it seems that the keep alive messages should be sent right after a connection_ack message and then periodically to keep the connection alive.

I would like Hasura to only send the keep alive messages after the connection has been made and a GQL_CONNECTION_ACK has been sent from the server.

@vincentjames501
Copy link

This needs a bump. We are trying to use the Netflix dgs library and it also asserts this and the connection closes immediately when it receive the "ka" message before the "GQL_CONNECTION_INIT" message:

    private fun doHandshake(): Mono<Void> {
        return Mono.defer {
            connection.set(client.connect().subscribe())

            client.send(CONNECTION_INIT_MESSAGE)
            client.receive()
                .take(1)
                .map { message ->
                    if (message.type == GQL_CONNECTION_ACK) {
                        message
                    } else {
                        throw GraphQLException("Acknowledgement expected from server, received $message")
                    }
                }
                .timeout(acknowledgementTimeout)
                .then()
        }
    }
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants