Open Nollknolle opened 3 weeks ago
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
# 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}")
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