alphacep / alphacep/vosk-server

Error in connection handler

Abierto
#253 0 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.3k
Forks
317
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I get the following error with this python code:
---------------------------------------------------------
INFO:root:Connection from ('xx.xx.xxx.xxx', 63393)
INFO:root:Config {'sample_rate': 16000}
ERROR:websockets.server:Error in connection handler
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/websockets/server.py", line 191, in handler
await self.ws_handler(self, path)
File "/opt/vosk-server/websocket/./asr_server.py", line 70, in recognize
await websocket.send(response)
File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 555, in send
await self.ensure_open()
File "/usr/lib/python3/dist-packages/websockets/protocol.py", line 803, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1000 (OK), no reason

```py
# Konfiguration für den Vosk-Server
vosk_server_url = 'ws://xx.xx.xxx.xxx:2700'

async def run_vosk_client(uri):
async with websockets.connect(uri) as websocket:
print("WebSocket connection established.")

duration = 5 # Aufnahmedauer in Sekunden
sample_rate = 16000 # Abtastfrequenz in Hz

print(f"Sprechen Sie etwas für {duration} Sekunden...")

audio_data = await record_audio(duration, sample_rate)

config_message = json.dumps({"config": {"sample_rate": sample_rate}})
await websocket.send(config_message)

await websocket.send(audio_data)
await websocket.send('{"eof" : 1}')

response = await websocket.recv()
print(f"Erkannter Text: {response}")
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.