There was an errors on reconnect
Error: cannot call send() while not connected
If add some checkouts, reconnection works fine and on the next mic data chunk it will reconnect to the client BUT there are no transcript events now
deepgram.addListener(LiveTranscriptionEvents.Close, async () => { console.log("deepgram: disconnected"); clearInterval(keepAlive); if (deepgram.getReadyState() === 1) deepgram.finish(); });
else if (deepgram.getReadyState() >= 2 /* 2 = CLOSING, 3 = CLOSED */) { console.log("ws: data couldn't be sent to deepgram"); console.log("ws: retrying connection to deepgram"); /* Attempt to reopen the Deepgram connection */ if (deepgram.getReadyState() === 1) deepgram.finish(); deepgram.removeAllListeners(); deepgram = setupDeepgram(ws); }
the problem was that MediaRecorder sending headers in first chunk, so if the headers missing it won't work, that why it worked with audio worklets and raw audio data
There was an errors on reconnect
Error: cannot call send() while not connected
If add some checkouts, reconnection works fine and on the next mic data chunk it will reconnect to the client BUT there are no transcript events nowdeepgram.addListener(LiveTranscriptionEvents.Close, async () => { console.log("deepgram: disconnected"); clearInterval(keepAlive); if (deepgram.getReadyState() === 1) deepgram.finish(); });
else if (deepgram.getReadyState() >= 2 /* 2 = CLOSING, 3 = CLOSED */) { console.log("ws: data couldn't be sent to deepgram"); console.log("ws: retrying connection to deepgram"); /* Attempt to reopen the Deepgram connection */ if (deepgram.getReadyState() === 1) deepgram.finish(); deepgram.removeAllListeners(); deepgram = setupDeepgram(ws); }