KeepAlive doesn't work #184
-
In my project, first messages will be sent to Deepgram around 30 seconds after the connection with Deepgram is established, that's why I'm using import websocket
from pprint import pprint
import threading
import json
from timeit import default_timer as timer
ws = None
def handleDeepgram():
global ws
extra_headers = {
'Authorization': 'Token XXXXX'
}
websocket.enableTrace(False)
ws = websocket.WebSocketApp(
encoding=mulaw&sample_rate=8000&model=phonecall&tier=nova&punctuate=true&numerals=true&language=en&endpointing=1500',
header = extra_headers,
on_message = on_message,
on_error = on_error,
on_close = on_close
)
ws.on_open = on_open
ws.run_forever()
def on_open(ws):
print('dziala dalej')
print(f"ws.deepgram_payload = {ws.deepgram_payload}")
ws.deepgram_still_configuring.value = False
threading.Thread(target=sendPayloadToDeepgram, args=(ws, ws.deepgram_payload)).start()
ws.send(json.dumps({"type":"KeepAlive"}))
print("przeszlo start()") Console:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have a fix for this on Deepgram's end (I think), will post here when it goes out, but in the meantime, I have a few applications where I send |
Beta Was this translation helpful? Give feedback.
I have a fix for this on Deepgram's end (I think), will post here when it goes out, but in the meantime, I have a few applications where I send
KeepAlive
messages once per second while I'm not sending audio, and those are keeping the connection alive for minutes - that might be a solution for now.