deepgram-starters / live-node-starter

Live transcription by Deepgram in Node.js
MIT License
12 stars 6 forks source link

Isn't receiving transcript events after the reconnect #6

Closed Ivan-juni closed 5 months ago

Ivan-juni commented 5 months ago
  1. 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); }

Ivan-juni commented 5 months ago

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