# GraphQL subscription error: Connection initialization timed out. No GQL_CONNECTION_INIT message received.

- **ID:** `api/graphql-subscription-connection-init-timeout`
- **Domain:** api
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 87%

## Root Cause

WebSocket connection for GraphQL subscriptions was established but the client did not send the required GQL_CONNECTION_INIT message within the server's timeout window (typically 10-30 seconds).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| graphql-ws 5.14 | active | — | — |
| subscriptions-transport-ws 0.11 | active | — | — |
| Apollo Server 4.10 | active | — | — |
| HotChocolate 13.0 | active | — | — |

## Workarounds

1. **Ensure the GraphQL client sends the GQL_CONNECTION_INIT message immediately after the WebSocket connection opens. In Apollo Client, this is automatic, but if using a custom WebSocket, send it in the 'open' event handler.** (95% success)
   ```
   Ensure the GraphQL client sends the GQL_CONNECTION_INIT message immediately after the WebSocket connection opens. In Apollo Client, this is automatic, but if using a custom WebSocket, send it in the 'open' event handler.
   ```
2. **Use a library that handles the handshake automatically, such as graphql-ws client or Apollo Client's subscription support, instead of raw WebSocket.** (90% success)
   ```
   Use a library that handles the handshake automatically, such as graphql-ws client or Apollo Client's subscription support, instead of raw WebSocket.
   ```

## Dead Ends

- **** — A longer timeout masks the real issue (missing init message) and may cause resource leaks from stale connections; the client should send init promptly. (80% fail)
- **** — Reconnection does not fix the missing init message; the same error will recur unless the client code is fixed to send GQL_CONNECTION_INIT. (90% fail)
