Closed tieje3 closed 1 week ago
This is not an SDK issue, but an idiosyncrasy with the API. When you send an audio stream, the start (first 4 bytes) of the audio stream contains the header information that helps Deepgram discover the audio type.
You can tackle this in few ways. Either;
This is not an SDK issue, but an idiosyncrasy with the API. When you send an audio stream, the start (first 4 bytes) of the audio stream contains the header information that helps Deepgram discover the audio type.
You can tackle this in few ways. Either;
1. Keep those 4 bytes in your app, and when you reconnect, intersect them into your audio stream for the first packet you then send to the API. 2. (and probably easier) Configure the Deepgram client with encoding/etc 3. (easiest but can be used case specific) Stop your audio stream and start it again after the connection is live
Thank you, I've got it working now. Instead of pausing the mic, I should have stopped it and set it up again. Specifying encoding did not work, however.
What is the current behavior?
Deepgram API does not return data upon disconnecting and reconnecting Websocket.
Disconnect definition
First Connection
First Connection is successful. Deepgram sends transcription data. The connection is closed properly.
first_connection.txt
Second Connection
Second Connection is successful, but Deepgram does not send transcription data. The websocket connection times out from Deepgram's side stating that data was not sent, but it clearly was.
second_connection.txt
Steps to reproduce
Use
useEffect()
fromReact
to disconnect and then reconnect with Deepgram API.Expected behavior
Successful re-connection with Deepgram API should return results.
Please tell us about your environment
Other information