#Why do my websocket connection closes abruptly with ServerError ?
1 messages · Page 1 of 1 (latest)
Hi @cursive hedge. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
There could be several reasons why your WebSocket connection is closing abruptly with a ServerError. Here are some possibilities based on the information provided in the knowledge sources:
-
Timeout due to lack of data: Deepgram's API will close the WebSocket connection if it doesn't receive any audio data within a certain timeframe. Even if you're sending KeepAlive messages, the connection will close if Deepgram doesn't receive enough audio to send a message over the WebSocket within the first 10 seconds of it opening. If Deepgram doesn't receive any audio data within ~10 seconds after opening the WebSocket, the connection will be closed (source (https://developers.deepgram.com/docs/troubleshooting-websocket-data-and-net-errors-when-live-streaming-audio)).
-
Mismatch in encoding: If the encoding option on the querystring doesn't match what the WebSocket endpoint is receiving, it could lead to a WebSocket connection closed unexpectedly (source (https://github.com/orgs/deepgram/discussions/707)).
-
Network issues: There could be potential network issues that are causing the WebSocket connection to close. You can troubleshoot this by testing your network by making a cURL request to Deepgram using a Deepgram-hosted audio file (source (https://developers.deepgram.com/docs/troubleshooting-websocket-data-and-net-errors-when-live-streaming-audio)).
-
Disrupted Connections: The connection could be disrupted due to internal or external factors, including bandwidth limitations and network failures. In these cases, your application must initialize a new WebSocket connection and start a new streaming session (source (https://developers.deepgram.com/docs/recovering-from-connection-errors-and-timeouts-when-live-streaming-audio)).
- Error codes: Deepgram uses certain error codes to indicate the reason for closing the WebSocket connection. For example,
1008indicates that the payload cannot be decoded as audio,1011withNET-0000indicates that the service has not transmitted a Text frame to the client within the timeout window, and1011withNET-0001indicates that the service has not received a Binary or Text frame from the client within the timeout window (source (https://developers.deepgram.com/reference/listen-live)).
To resolve these issues, ensure that you're sending audio data within the required timeframe, check your network connection, and ensure that the encoding matches what the WebSocket endpoint is expecting. If the problem persists, you may want to reach out to Deepgram's support for further assistance.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@cursive hedge kapa.ai is still learning and improving, please let us know how it did by reacting below
@midnight harness what does this message tell : {"type":"Metadata","transaction_key":"deprecated","request_id":"b281833c-ed89-4732-84fc-43ced55440b0","sha256":"incomplete","created":"2024-06-26T14:58:21.908Z","duration":55.78,"channels":1,"models":["c0d1a568-ce81-4fea-97e7-bd45cb1fdf3c"],"model_info":{"c0d1a568-ce81-4fea-97e7-bd45cb1fdf3c":{"name":"2-general-nova","version":"2024-01-18.26916","arch":"nova-2"}}}
Let me check the knowledge base for you. One moment! :books:
The message you're seeing is a metadata message from Deepgram's API. Here's what each field means:
-
"type":"Metadata": This indicates that the message type is Metadata. Metadata messages provide information about the audio file and the models used to process it. -
"transaction_key":"deprecated": This field is deprecated and no longer in use. -
"request_id":"b281833c-ed89-4732-84fc-43ced55440b0": This is the unique identifier for your request. You can use this ID to reference your request if you need to contact Deepgram's support. -
"sha256":"incomplete": This field would normally contain the SHA-256 hash of the audio data. The value "incomplete" suggests that the audio data is not yet fully processed. -
"created":"2024-06-26T14:58:21.908Z": This is the timestamp of when the request was created. -
"duration":55.78: This is the duration of the audio file in seconds. -
"channels":1: This indicates that the audio file has one channel. -
"models":["c0d1a568-ce81-4fea-97e7-bd45cb1fdf3c"]: This is the list of models used to process the audio file. The IDs are unique identifiers for each model. -
"model_info":{"c0d1a568-ce81-4fea-97e7-bd45cb1fdf3c":{"name":"2-general-nova","version":"2024-01-18.26916","arch":"nova-2"}}: This provides information about the model used, including its name, version, and architecture.