I’m experiencing an issue with the Gemini Live API where the WebSocket connection unexpectedly closes with error code 1008 and the reason “Operation is not implemented, or supported, or enabled.” Here’s the context:
I’m using the @google/genai SDK (latest version) with the gemini-2.5-flash-native-audio-preview-12-2025 model in a Next.js 16 browser environment. I’m trying to establish a direct WebSocket connection to the Live API for audio streaming.
For my setup, I initialize the GoogleGenAI client with a valid API key and configure it with audio modality, the Aoede voice, and generation parameters like temperature 0.7, topP 0.9, and topK 40. I’m sending 16-bit PCM audio at 16kHz mono little-endian in 20-40ms chunks as recommended, and expecting 24kHz audio back.
The connection pattern is this: it establishes successfully and the onopen callback fires. Sometimes I even start receiving the first audio response. But then the connection abruptly closes with code 1008. According to RFC 6455, code 1008 indicates a policy violation where the endpoint terminates because it received a message violating its policy.
I’ve tried several things to fix this. Initially I had a deprecation warning about setting generation_config in a nested object, so I moved those fields to the top level of LiveConnectConfig as the warning suggested. I also tried adding realtimeInputConfig with automaticActivityDetection disabled, reducing chunk sizes, validating my audio format multiple times, and implementing reconnection logic. None of these resolved the 1008 error.
My audio streaming follows Google’s best practices: chunk sizes of 20-40ms, 16kHz input sample rate, 24kHz output, 16-bit PCM mono little-endian format. Everything seems correct according to the documentation.
What I’m seeing in the logs is a successful connection, then I send audio chunks using sendRealtimeInput with the media object containing mimeType “audio/pcm;rate=16000” and base64-encoded data. The server responds with setupComplete, receives my audio chunks, sometimes starts sending audio response frames, then suddenly closes the connection with code 1008.
I’m trying to figure out what specific operation or configuration is triggering this error. Is it related to the model I’m using? Is this model still supported and available? Am I missing required fields in LiveConnectConfig? Could this be a rate limit or quota issue that’s showing up as error 1008 instead of something more specific? Does my API key need special permissions or scopes for Live API access?
This is happening in a real-time voice interview application where users speak and their audio is captured at 16kHz, sent to the API in small chunks, and the AI responds with audio at 24kHz that gets played back. The application works for the initial connection but fails intermittently with these 1008 errors, making it impossible to complete full voice conversations.
I really need to understand the root cause of this error, get the correct configuration for stable Live API WebSocket connections, learn about any model-specific requirements for audio streaming, and find out if the API behavior has changed since the documentation was written.