async def _keepalive_task_handler(self):
        """Send periodic empty audio chunks to keep the connection alive."""
        try:
            while True:
                # Send keepalive every 20 seconds (Gladia times out after 30 seconds)
                await asyncio.sleep(20)
                if self._websocket and not self._websocket.closed:
                    # Send an empty audio chunk as keepalive
                    empty_audio = b""
                    await self._send_audio(empty_audio)
                else:
                    logger.debug("Websocket closed, stopping keepalive")
                    break
        except websockets.exceptions.ConnectionClosed:
            logger.debug("Connection closed during keepalive")
        except Exception as e:
            logger.error(f"Error in Gladia keepalive task: {e}")
Send periodic empty audio chunks to keep the connection alive.
src/pipecat/services/gladia/stt.py