#Websocket connection closes on it's own without any reason

1 messages · Page 1 of 1 (latest)

cobalt sequoia
#

LiveTranscription WebSocket Issue

I'm encountering an issue with liveTranscription where the WebSocket connection is closing unexpectedly without any apparent reason. Here are the relevant event logs:

  1. WebSocket connection opened:

    Event {
      isTrusted: true,
      type: 'open',
      target: WebSocket,
      currentTarget: WebSocket,
      eventPhase: 2,
      // ... other properties
    }
    
  2. Received a metadata message from the WebSocket:

    {
      type: 'Metadata',
      transaction_key: 'deprecated',
      request_id: '0d78946a-4dec-4dd5-8f04-29c57b88999d',
      sha256: 'e8e87ea618646272d661edb61cd469cffbfb95b2b0415ff1b95bbe5d143ea990',
      created: '2024-07-11T21:57:44.587Z',
      // ... other properties
    }
    
  3. WebSocket closed:

    CloseEvent {
      isTrusted: true,
      wasClean: true,
      code: 1000,
      reason: '',
      type: 'close',
      // ... other properties
    }
    

The WebSocket URL used: wss://api.deepgram.com/v1/listen?model=nova-2&replace=bau:Bao&language=en&punctuate=true

If anyone has insights into why the WebSocket might be closing prematurely or suggestions for troubleshooting, I'd greatly appreciate your help!

valid summitBOT
#

Thanks for asking your question. Please be sure to reply with as much detail as possible so we can assist you efficiently. Such as:

  • Provide the request_id if you've a question about a transcription response.
  • The options you used or the api.deepgram.com URL you sent your request to, including parameters.
  • Any code snippets you can include.
  • Any audio you can include, or if you can't share it here please email it to us at [email protected] and provide a link to this thread.
graceful pasture
#

hi @cobalt sequoia

The usual suspects are:

  1. sending an empty byte/array to the server. internally that's a mechanism to force a connection close
  2. no audio data received and you get timed out. in this case, enable keepalives
  3. the audio stream encoding doesnt match what's set for the deepgram encoding value
  4. you are muting/unmuting or starting/stopping the audio stream and you are not setting both the encoding and sample_rate values
#

if you had some code to look at, that might be helpful. also might be helpful to know the context of what you are trying to do besides "doing transcription"

cobalt sequoia
#

@graceful pasture
I managed to solve this, needed to set mediaRecorder in onConnect.

Side question: is there any limit to number of requests you can make with a valid api key at one point (Concurrent requests).

graceful pasture
#

for pay-as-you-go, the limit is 100

cobalt sequoia
#

Okay does that mean I can only have 100 liveTS as a whole for pay-as-you-go project or 100 per API key?

One more question, generating key takes a bit too long (sometimes 5 sec+), is there something we can do to speed it up (Other than generating in advance)