#Use livestream from Browser.

1 messages · Page 1 of 1 (latest)

warm knot
#

Hello,

Is using this from Web Browser deprecated?

  const ws = new WebSocket("wss://api.deepgram.com/v1/listen", [
    "token",
    "MY_TOKEN",
  ]);

The behavior that I have is the first request is working, I receive back the transcript text. But on the second websocket message we receive back a deprecated message instead.

Object { type: "Metadata", transaction_key: "deprecated", request_id: "26cecf1c-4d3a-4ac9-a181-3de1d5b8606e", sha256: "d92d87ee7635b24ec86adaa529060bf2df912a7f262fa147e0ada1cc15657fcf", created: "2023-10-23T18:26:42.171Z", duration: 3.7151875, channels: 1, models: (1) […], model_info: {…} }
​
channels: 1created: "2023-10-23T18:26:42.171Z"duration: 3.7151875model_info: Object { "96a295ec-6336-43d5-b1cb-1e48b5e6d9a4": {…} }
​​
"96a295ec-6336-43d5-b1cb-1e48b5e6d9a4": Object { name: "general", version: "2023-02-22.3", arch: "base" }
​​
<prototype>: Object { … }
​
models: Array [ "96a295ec-6336-43d5-b1cb-1e48b5e6d9a4" ]
​​
0: "96a295ec-6336-43d5-b1cb-1e48b5e6d9a4"
​​
length: 1
​​
<prototype>: Array []
​
request_id: "26cecf1c-4d3a-4ac9-a181-3de1d5b8606e"sha256: "d92d87ee7635b24ec86adaa529060bf2df912a7f262fa147e0ada1cc15657fcf"transaction_key: "deprecated"type: "Metadata"
​
<prototype>: Object { … }
SpeechToTextDeepgram.js:94
warm knot
#

I must be doing something wrong. i also get the exact same behavior from when using flask.

ionic turret
#

Are you getting back the transcript? You can ignore the "deprecated" value for the transaction_key. That's a deprecated property but it doesn't mean you're doing anything wrong.

#

It looks like you're just receiving a Metadata response. You can receive two types of responses, Results or Metadata. So you should receive the Results after this if you keep the websocket connection open

warm knot
#

Once we receive the deprecated message the socket is closed by the server. If we send 10s chunks sometimes we get transcripts but soon enough the socket closes again. It looks like we can't do fast audio streaming to Deepgram like 1s chunks. We are using alternatives for now

gaunt mortar
#

The transaction_key field is deprecated and you can ignore this.

We will drop a connection if we recieve no audio data for more than 10-12s.

Have you tried our new JS SDK? It's still in alpha, so pin it at this version, and it will allow you to transcribe on the client side. This is the next version of our Node SDK, but it will be renamed to the JS SDK because it works in both the browser and Node. I'm keen to get your feedback 🙏

<script src="https://cdn.jsdelivr.net/npm/@deepgram/[email protected]"></script>

or

npm i @deepgram/[email protected]
warm knot
#

Thank you we will try it later on. Our usecase is we send 1 audio each seconds, is it supposed to work correctly or the connection will close?